[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / Parser / c2x-label.c
blobf7fcd6e524637cf7f6532654497a6792c5afb87e
1 // RUN: %clang_cc1 -fsyntax-only -std=c17 -Wc2x-compat -verify=c17 %s
2 // RUN: %clang_cc1 -fsyntax-only -std=c2x -Wpre-c2x-compat -verify=c2x %s
4 void test_label_in_func() {
5 int x;
6 label1:
7 x = 1;
8 label2: label3: label4:
9 } // c17-warning {{label at end of compound statement is a C23 extension}} \
10 c2x-warning {{label at end of compound statement is incompatible with C standards before C23}}
12 int test_label_in_switch(int v) {
13 switch (v) {
14 case 1:
15 return 1;
16 case 2:
17 return 2;
18 case 3: case 4: case 5:
19 } // c17-warning {{label at end of compound statement is a C23 extension}} \
20 c2x-warning {{label at end of compound statement is incompatible with C standards before C23}}
22 switch (v) {
23 case 6:
24 return 6;
25 default:
26 } // c17-warning {{label at end of compound statement is a C23 extension}} \
27 c2x-warning {{label at end of compound statement is incompatible with C standards before C23}}
29 return 0;