1 // RUN: %clang_cc1 -fsyntax-only -fdouble-square-bracket-attributes -verify %s
10 [[fallthrough
]]; // ok
15 for (int n
= 0; n
!= 10; ++n
)
16 [[fallthrough
]]; // expected-error {{does not directly precede switch label}}
19 [[fallthrough
]]; // expected-error {{does not directly precede switch label}}
22 [[fallthrough
]]; // expected-error {{does not directly precede switch label}}
24 do [[fallthrough
]]; while (1); // expected-error {{does not directly precede switch label}}
26 do [[fallthrough
]]; while (0); // expected-error {{does not directly precede switch label}}
30 // FIXME: This should be an error, even though the next thing we do is to
31 // fall through in an outer switch statement.
35 [[fallthrough
]]; // expected-error {{does not directly precede switch label}}
40 case 10: // no warning, -Wimplicit-fallthrough is not enabled in this test, and does not need to
41 // be enabled for these diagnostics to be produced.
46 [[fallthrough
]] typedef int n1
; // expected-error {{'fallthrough' attribute cannot be applied to a declaration}}
47 typedef int [[fallthrough
]] n2
; // expected-error {{'fallthrough' attribute cannot be applied to types}}
48 typedef int n3
[[fallthrough
]]; // expected-error {{'fallthrough' attribute cannot be applied to a declaration}}
50 enum [[fallthrough
]] E
{ // expected-error {{'fallthrough' attribute cannot be applied to a declaration}}
53 struct [[fallthrough
]] S
{ // expected-error {{'fallthrough' attribute cannot be applied to a declaration}}
57 [[fallthrough
]] // expected-error {{'fallthrough' attribute cannot be applied to a declaration}}
59 [[fallthrough
]] int n
; // expected-error {{'fallthrough' attribute cannot be applied to a declaration}}
60 [[fallthrough
]] ++n
; // expected-error {{'fallthrough' attribute only applies to empty statements}}
63 // FIXME: This should be an error.
68 [[fallthrough
, fallthrough
]]; // ok
70 [[fallthrough(0)]]; // expected-error {{argument list}}