1 // RUN: %clang_cc1 -x c++ %s -verify
2
3 // dr2406: yes
4
fallthrough(int n)5 void fallthrough(int n) {
6 void g(), h(), i();
7 switch (n) {
8 case 1:
9 case 2:
10 g();
11 [[fallthrough]];
12 case 3: // warning on fallthrough discouraged
13 do {
14 [[fallthrough]]; // expected-error {{fallthrough annotation does not directly precede switch label}}
15 } while (false);
16 case 6:
17 do {
18 [[fallthrough]]; // expected-error {{fallthrough annotation does not directly precede switch label}}
19 } while (n);
20 case 7:
21 while (false) {
22 [[fallthrough]]; // expected-error {{fallthrough annotation does not directly precede switch label}}
23 }
24 case 5:
25 h();
26 case 4: // implementation may warn on fallthrough
27 i();
28 [[fallthrough]]; // expected-error {{fallthrough annotation does not directly precede switch label}}
29 }
30 }
31