Correctly handle nested switch statements in CFGBuilder when on switch statement has a condition that evaluates to a constant.
llvm-svn: 126977
diff --git a/clang/test/SemaCXX/array-bounds.cpp b/clang/test/SemaCXX/array-bounds.cpp
index 5db9c1f..62b4d52 100644
--- a/clang/test/SemaCXX/array-bounds.cpp
+++ b/clang/test/SemaCXX/array-bounds.cpp
@@ -147,3 +147,16 @@
}
}
+// Test nested switch statements.
+enum enumA { enumA_A, enumA_B, enumA_C, enumA_D, enumA_E };
+enum enumB { enumB_X, enumB_Y, enumB_Z };
+static enum enumB myVal = enumB_X;
+void test_nested_switch()
+{
+ switch (enumA_E) { // expected-warning {{no case matching constant}}
+ switch (myVal) { // expected-warning {{enumeration values 'enumB_X' and 'enumB_Z' not handled in switch}}
+ case enumB_Y: ;
+ }
+ }
+}
+