1 /* Test C23 attribute syntax. Invalid use of fallthrough attribute. */
2 /* { dg-do compile } */
3 /* { dg-options "-std=c23 -pedantic-errors -Wextra" } */
5 [[fallthrough
]]; /* { dg-error "'fallthrough' attribute at top level" } */
7 int [[fallthrough
]] x
; /* { dg-error "ignored" } */
9 int g () [[fallthrough
]]; /* { dg-error "ignored" } */
11 int array
[2] [[fallthrough
]]; /* { dg-error "ignored" } */
13 int z
= sizeof (int [[fallthrough
]]); /* { dg-error "ignored" } */
18 [[fallthrough
]] int b
= 2; /* { dg-warning "not followed by" } */
19 /* { dg-error "ignored" "ignored" { target *-*-* } .-1 } */
23 b
= 1; /* { dg-warning "may fall through" } */
25 b
= 2; /* { dg-warning "may fall through" } */
26 [[fallthrough()]]; /* { dg-error "does not take any arguments" } */
31 b
= 4; /* { dg-warning "may fall through" } */
32 [[fallthrough(1)]]; /* { dg-error "does not take any arguments|expected" } */
36 [[fallthrough
]] case 6: break; /* { dg-error "ignored" } */
37 [[fallthrough
]] default: break; /* { dg-error "ignored" } */
39 [[fallthrough
]] return b
; /* { dg-error "ignored" } */
40 [[fallthrough
]] label
: ; /* { dg-error "ignored" } */