[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / Parser / cxx2b-init-statement.cpp
blob4986b402bf51d33ec7728b0a8af5cc6d40f26853
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
4 namespace ns {
5 int i;
6 enum class e {};
8 void f() {
10 for (using foo = int;true;); //expected-cxx20-warning {{alias declaration in this context is a C++23 extension}}
12 switch(using foo = int; 0) { //expected-cxx20-warning {{alias declaration in this context is a C++23 extension}}
13 case 0: break;
16 if(using foo = int; false) {} //expected-cxx20-warning {{alias declaration in this context is a C++23 extension}}
19 if (using enum ns::e; false){} // expected-error {{expected '='}}
21 for (using ns::i; true;); // expected-error {{expected '='}}
23 if (using ns::i; false){} // expected-error {{expected '='}}
25 switch(using ns::i; 0) { // expected-error {{expected '='}}
26 case 0: break;