xref: /llvm-project/clang/test/Parser/cxx2b-init-statement.cpp (revision ba15d186e5cef2620d562c6c9d9a6d570382cd0a)
1 // RUN: %clang_cc1 -fsyntax-only -verify=expected -std=c++23 -Wall %s
2 // RUN: %clang_cc1 -fsyntax-only -verify=expected,expected-cxx20 -std=c++20 -Wall %s
3 
4 namespace ns {
5     int i;
6     enum class e {};
7 }
f()8 void f() {
9 
10     for (using foo = int;true;); //expected-cxx20-warning {{alias declaration in this context is a C++23 extension}}
11 
12     switch(using foo = int; 0) { //expected-cxx20-warning {{alias declaration in this context is a C++23 extension}}
13         case 0: break;
14     }
15 
16     if(using foo = int; false) {} //expected-cxx20-warning {{alias declaration in this context is a C++23 extension}}
17 
18 
19     if (using enum ns::e; false){}  // expected-error {{expected '='}}
20 
21     for (using ns::i; true;);  // expected-error {{expected '='}}
22 
23     if (using ns::i; false){}  // expected-error {{expected '='}}
24 
25     switch(using ns::i; 0) {   // expected-error {{expected '='}}
26         case 0: break;
27     }
28 
29 }
30