Debian Codegraph @

gcc/testsuite/g++.dg/cpp1z/fallthrough2.C

raw
1 // { dg-do compile { target c++17 } }
2 // { dg-options "-Wextra -Wall -Wpedantic" }
3
4 int
5 foo (int i)
6 {
7 switch (i)
8 {
9 case 2:
10 ++i;
11 [[fallthrough, whatever::fallthrough]]; // { dg-bogus "attribute 'fallthrough' specified multiple times" }
12 case 3: // { dg-warning "'fallthrough' attribute ignored" "" { target *-*-* } .-1 }
13 ++i;
14 [[fallthrough, whatever2::fallthrough(1, 2, 3)]]; // { dg-bogus "attribute 'fallthrough' specified multiple times" }
15 case 4: // { dg-warning "'fallthrough' attribute ignored" "" { target *-*-* } .-1 }
16 [[whatever3::fallthrough("abcd")]]; // { dg-warning "attributes at the beginning of statement are ignored" }
17 case 5:
18 [[whatever4::fallthrough]]; // { dg-bogus "attribute 'fallthrough' not preceding a case label or default label" }
19 ++i; // { dg-warning "attributes at the beginning of statement are ignored" "" { target *-*-* } .-1 }
20 default:
21 break;
22 }
23 return i;
24 }