bad-control.c 674 B

123456789101112131415161718192021222324
  1. /* RUN: %clang_cc1 -fsyntax-only -verify %s
  2. */
  3. void foo() {
  4. break; /* expected-error {{'break' statement not in loop or switch statement}} */
  5. }
  6. void foo2() {
  7. continue; /* expected-error {{'continue' statement not in loop statement}} */
  8. }
  9. int pr8880_9 (int first) {
  10. switch(({ if (first) { first = 0; break; } 1; })) { // expected-error {{'break' statement not in loop or switch statement}}
  11. case 2: return 2;
  12. default: return 0;
  13. }
  14. }
  15. void pr8880_24() {
  16. for (({break;});;); // expected-error {{'break' statement not in loop or switch statement}}
  17. }
  18. void pr8880_25() {
  19. for (({continue;});;); // expected-error {{'continue' statement not in loop statement}}
  20. }