[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / SemaCXX / switch-implicit-fallthrough-per-method.cpp
blob6880bdd5f47d5f847b1d66f10a6cbad4f8e6cb45
1 // RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 -Wimplicit-fallthrough-per-function %s
4 int fallthrough(int n) {
5 switch (n / 10) {
6 case 0:
7 n += 100;
8 case 1: // expected-warning{{unannotated fall-through}} expected-note{{insert '[[clang::fallthrough]];' to silence this warning}} expected-note{{insert 'break;' to avoid fall-through}}
9 switch (n) {
10 case 111:
11 n += 111;
12 [[clang::fallthrough]];
13 case 112:
14 n += 112;
15 case 113: // expected-warning{{unannotated fall-through}} expected-note{{insert '[[clang::fallthrough]];' to silence this warning}} expected-note{{insert 'break;' to avoid fall-through}}
16 n += 113;
17 break ;
20 return n;
23 int fallthrough2(int n) {
24 switch (n / 10) {
25 case 0:
26 n += 100;
27 case 1: // no warning, as we didn't "opt-in" for it in this method
28 switch (n) {
29 case 111:
30 n += 111;
31 case 112: // no warning, as we didn't "opt-in" for it in this method
32 n += 112;
33 case 113: // no warning, as we didn't "opt-in" for it in this method
34 n += 113;
35 break ;
38 return n;
41 void unscoped(int n) {
42 switch (n % 2) {
43 case 0:
44 [[fallthrough]];
45 case 2:
46 [[clang::fallthrough]];
47 case 1:
48 break;