llvm-project/clang/test/SemaCXX/cxx2b-init-statement.cpp
Mark de Wever ba15d186e5 [clang] Use -std=c++23 instead of -std=c++2b
During the ISO C++ Committee meeting plenary session the C++23 Standard
has been voted as technical complete.

This updates the reference to c++2b to c++23 and updates the __cplusplus
macro.

Drive-by fixes c++1z -> c++17 and c++2a -> c++20 when seen.

Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D149553
2023-05-04 19:19:52 +02:00

29 lines
1.0 KiB
C++

// RUN: %clang_cc1 -verify -std=c++23 -Wall -Wshadow %s
void f() {
for (using foo = int;true;) {} //expected-warning {{unused type alias 'foo'}}
switch(using foo = int; 0) { //expected-warning {{unused type alias 'foo'}}
case 0: break;
}
if(using foo = int; false) {} // expected-warning {{unused type alias 'foo'}}
int x; // expected-warning {{unused variable 'x'}}
if(using x = int; true) {} // expected-warning {{unused type alias 'x'}}
using y = int; // expected-warning {{unused type alias 'y'}} \
// expected-note 2{{previous declaration is here}}
if(using y = double; true) {} // expected-warning {{unused type alias 'y'}} \
// expected-warning {{declaration shadows a type alias in function 'f'}}
for(using y = double; true;) { // expected-warning {{declaration shadows a type alias in function 'f'}}
y foo = 0;
(void)foo;
constexpr y var = 0;
static_assert(var == 0);
}
}