]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/testsuite/gcc.dg/c2x-attr-fallthrough-6.c
aa7ff4cdd2a364a1fe264edb8ee63ce2a4ca77a3
[thirdparty/gcc.git] / gcc / testsuite / gcc.dg / c2x-attr-fallthrough-6.c
1 /* Test C2x attribute syntax. Invalid use of fallthrough attribute in
2 bad context inside switch. */
3 /* { dg-do compile } */
4 /* { dg-options "-std=c2x -pedantic-errors -Wextra" } */
5
6 int
7 f (int a)
8 {
9 switch (a)
10 {
11 case 1:
12 a++;
13 [[fallthrough]]; /* { dg-error "attribute 'fallthrough' not preceding a case label or default label" } */
14 a++;
15 [[fallthrough]]; /* { dg-error "attribute 'fallthrough' not preceding a case label or default label" } */
16 }
17 return a;
18 }