Fortran: Fix PR 47485.
[gcc.git] / gcc / testsuite / g++.dg / warn / Wimplicit-fallthrough-2.C
blobcacaf55bb492a2920b258b35e3e4e3acdfdcaf3b
1 // PR c++/77886
2 // { dg-do compile }
3 // { dg-options "-Wimplicit-fallthrough" }
5 template <int N>
6 int
7 foo (int x, int y)
9   switch (x)
10     {
11     case 1:
12       x++;              // { dg-bogus "this statement may f\[ahlotu\]*gh" }
13       // FALLTHROUGH
14     case 2:
15       x++;
16       break;
17     case 3:
18       x++;              // { dg-bogus "this statement may f\[ahlotu\]*gh" }
19       // FALLTHROUGH
20     lab:
21     case 4:
22       x++;
23       break;
24     case 5:
25       x++;              // { dg-bogus "this statement may f\[ahlotu\]*gh" }
26       // FALLTHROUGH
27     default:
28       x++;
29       break;
30     case 26:
31       goto lab;
32     }
33 #if __cplusplus >= 201103L
34   switch (y)
35     {
36     case 1:
37       y++;              // { dg-bogus "this statement may f\[ahlotu\]*gh" }
38       [[fallthrough]];
39     case 2:
40       y++;
41       break;
42     case 3:
43       y++;              // { dg-bogus "this statement may f\[ahlotu\]*gh" }
44       [[fallthrough]];
45     lab2:
46     case 4:
47       y++;
48       break;
49     case 5:
50       y++;              // { dg-bogus "this statement may f\[ahlotu\]*gh" }
51       [[fallthrough]];
52     default:
53       y++;
54       break;
55     case 26:
56       goto lab2;
57     }
58 #endif
59   return x + y;
62 int
63 bar (int x, int y)
65   return foo<0> (x, y);