1 // RUN: %clang_cc1 -verify -std=c23 %s
2 // RUN: %clang_cc1 -verify=pedantic -std=c11 -pedantic %s
3 // RUN: %clang_cc1 -verify=compat -std=c23 -Wpre-c23-compat %s
5 // expected-no-diagnostics
8 * Free positioning of labels inside compound statements
13 } /* pedantic-warning {{label at end of compound statement is a C23 extension}}
14 compat-warning {{label at end of compound statement is incompatible with C standards before C23}}
19 } /* pedantic-warning {{label at end of compound statement is a C23 extension}}
20 compat-warning {{label at end of compound statement is incompatible with C standards before C23}}
24 multiple
: labels
: on
: a
: line
:
25 } /* pedantic-warning {{label at end of compound statement is a C23 extension}}
26 compat-warning {{label at end of compound statement is incompatible with C standards before C23}}
30 } /* pedantic-warning {{label at end of compound statement is a C23 extension}}
31 compat-warning {{label at end of compound statement is incompatible with C standards before C23}}
34 void test_labels(void) {
36 int i
= 0; /* pedantic-warning {{label followed by a declaration is a C23 extension}}
37 compat-warning {{label followed by a declaration is incompatible with C standards before C23}}
42 _Static_assert(1, ""); /* pedantic-warning {{label followed by a declaration is a C23 extension}}
43 compat-warning {{label followed by a declaration is incompatible with C standards before C23}}
46 _Static_assert(1, ""); /* pedantic-warning {{label followed by a declaration is a C23 extension}}
47 compat-warning {{label followed by a declaration is incompatible with C standards before C23}}