1 /* Test for proper errors for break and continue in nested functions.  */
2 /* Origin: Joseph Myers <jsm@polyomino.org.uk> */
3 /* { dg-do compile } */
4 /* { dg-options "-Wno-switch-unreachable" } */
5 
6 void
foo(int a)7 foo (int a)
8 {
9   switch (a) {
10     void bar1 (void) { break; } /* { dg-error "break statement" "break switch 1" } */
11   }
12   switch (a) {
13   case 0:
14     (void) 0;
15     void bar2 (void) { break; } /* { dg-error "break statement" "break switch 2" } */
16   }
17   while (1) {
18     void bar3 (void) { break; } /* { dg-error "break statement" "break while" } */
19   }
20   do {
21     void bar4 (void) { break; } /* { dg-error "break statement" "break do" } */
22   } while (1);
23   for (;;) {
24     void bar5 (void) { break; } /* { dg-error "break statement" "break for" } */
25   }
26   while (1) {
27     void bar6 (void) { continue; } /* { dg-error "continue statement" "continue while" } */
28   }
29   do {
30     void bar7 (void) { continue; } /* { dg-error "continue statement" "continue do" } */
31   } while (1);
32   for (;;) {
33     void bar8 (void) { continue; } /* { dg-error "continue statement" "continue for" } */
34   }
35 }
36