* decl.c (make_typename_type): s/parameters/arguments/.
[official-gcc.git] / gcc / testsuite / g++.dg / cpp0x / fallthrough1.C
blob523067e6849c104c51d0e27a841c0f8e607d0d31
1 // PR c/7652
2 // { dg-do compile { target c++11 } }
3 // { dg-options "-Wextra -Wall -Wpedantic" }
5 extern void bar (int);
6 void
7 fn (int i)
9   [[gnu::fallthrough]] int j = 0; // { dg-warning "attribute ignored" }
11   if (j)
12     [[gnu::fallthrough]];  // { dg-error "invalid use" }
14   [[gnu::fallthrough]];  // { dg-error "invalid use" }
15   switch (i)
16   {
17     [[gnu::fallthrough]]; // { dg-warning "statement will never" }
18   case 1:
19    i++;
20    [[gnu::fallthrough]];
21   case 2:
22     if (i) // { dg-warning "statement may fall through" }
23       bar (2);
24     else
25       [[gnu::fallthrough]];
26   case 3:
27     if (i > 1)
28       [[gnu::fallthrough]];
29     else
30       return;
31   case 4:
32     if (i)
33       [[gnu::fallthrough]]; // { dg-warning "not preceding" }
34     [[gnu::fallthrough]];
35   case 5:
36    ;
37    [[gnu::fallthrough]];
38   case 6:
39     if (i) // { dg-warning "statement may fall through" }
40       bar (6);
41     else
42       {
43         [[gnu::fallthrough]];
44       }
45   case 7:
46     if (i > 1)
47       {
48         [[gnu::fallthrough]];
49       }
50     else
51       bar (7); // { dg-warning "statement may fall through" }
52   default:
53     --j;
54   }
56   [[gnu::fallthrough]]; // { dg-error "invalid use" }