xref: /llvm-project/clang/test/Parser/bad-control.c (revision 7deaeb2a056c1756ce6f2550d2ebb91b81b9ff29)
1 /* RUN: %clang_cc1 -fsyntax-only -verify %s
2 */
foo(void)3 void foo(void) {
4   break; /* expected-error {{'break' statement not in loop or switch statement}} */
5 }
6 
foo2(void)7 void foo2(void) {
8   continue; /* expected-error {{'continue' statement not in loop statement}} */
9 }
10 
pr8880_9(int first)11 int pr8880_9 (int first) {
12   switch(({ if (first) { first = 0; break; } 1; })) { // expected-error {{'break' statement not in loop or switch statement}}
13   case 2: return 2;
14   default: return 0;
15   }
16 }
17 
pr8880_24(void)18 void pr8880_24(void) {
19   for (({break;});;); // expected-error {{'break' statement not in loop or switch statement}}
20 }
21 
pr8880_25(void)22 void pr8880_25(void) {
23   for (({continue;});;); // expected-error {{'continue' statement not in loop statement}}
24 }
25