xref: /llvm-project/clang/test/SemaCXX/switch-implicit-fallthrough-off-by-default.cpp (revision 4d3d785e3f9713e700c94d6d78b5a695daa98f1d)
1 // RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 -DUNREACHABLE=1 %s
2 // RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 -DUNREACHABLE=0 -Wimplicit-fallthrough %s
3 
fallthrough(int n)4 void fallthrough(int n) {
5   switch (n) {
6   case 1:
7     if (UNREACHABLE)
8       return;
9     [[fallthrough]]; // expected-no-diagnostics, only checked when UNREACHABLE=0
10   case 2:
11     break;
12   }
13 }
14