start checking case values of switch stmts more closely. Emit overflow
warnings when converting case values to the expression type.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41313 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/Sema/switch.c b/test/Sema/switch.c
index 0c244cf..8559e0d 100644
--- a/test/Sema/switch.c
+++ b/test/Sema/switch.c
@@ -1,9 +1,16 @@
// RUN: clang -parse-ast-check %s
-
void f (int z) {
while (z) {
default: z--; // expected-error {{statement not in switch}}
}
}
+void foo(int X) {
+ switch (X) {
+ case 5000000000LL: // expected-warning {{overflow}}
+ case 42:
+ ;
+ }
+}
+