16 lines · c
1// To be used with cxx11-statement-attributes.cpp.2template<const int N>3int f(int n) {4 switch (n * N) {5 case 0:6 n += 15;7 [[clang::fallthrough]]; // This shouldn't generate a warning.8 case 1:9 n += 20;10 case 2: // This should generate a warning: "unannotated fallthrough"11 n += 35;12 break;13 }14 return n;15}16