xref: /minix3/external/bsd/llvm/dist/clang/test/PCH/Inputs/cxx11-statement-attributes.h (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // To be used with cxx11-statement-attributes.cpp.
2*f4a2713aSLionel Sambuc template<const int N>
f(int n)3*f4a2713aSLionel Sambuc int f(int n) {
4*f4a2713aSLionel Sambuc   switch (n * N) {
5*f4a2713aSLionel Sambuc     case 0:
6*f4a2713aSLionel Sambuc       n += 15;
7*f4a2713aSLionel Sambuc       [[clang::fallthrough]];  // This shouldn't generate a warning.
8*f4a2713aSLionel Sambuc     case 1:
9*f4a2713aSLionel Sambuc       n += 20;
10*f4a2713aSLionel Sambuc       [[clang::fallthrough]];  // This should generate a warning: "fallthrough annotation does not directly precede switch label".
11*f4a2713aSLionel Sambuc       break;
12*f4a2713aSLionel Sambuc   }
13*f4a2713aSLionel Sambuc   return n;
14*f4a2713aSLionel Sambuc }
15