summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/switch-implicit-fallthrough-off-by-default.cpp
blob: 6ab6370069afe6726affd8459b5bab333a303bf0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 -DUNREACHABLE=1 %s
// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 -DUNREACHABLE=0 -Wimplicit-fallthrough %s

void fallthrough(int n) {
  switch (n) {
  case 1:
    if (UNREACHABLE)
      return;
    [[fallthrough]]; // expected-no-diagnostics, only checked when UNREACHABLE=0
  case 2:
    break;
  }
}
OpenPOWER on IntegriCloud