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