Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / CXX / drs / dr2406.cpp
blob7ea0870fb70b380216aa5df74b9d4da813502d3e
1 // RUN: %clang_cc1 -x c++ %s -verify
3 // dr2406: yes
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}}
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}}