summaryrefslogtreecommitdiffstats
path: root/test/Sema/switch.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/Sema/switch.c')
-rw-r--r--test/Sema/switch.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/test/Sema/switch.c b/test/Sema/switch.c
index 092378d..7aa695d 100644
--- a/test/Sema/switch.c
+++ b/test/Sema/switch.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify -Wswitch-enum -Wcovered-switch-default %s
+// RUN: %clang_cc1 -fsyntax-only -verify -Wswitch-enum -Wcovered-switch-default -triple x86_64-linux-gnu %s
void f (int z) {
while (z) {
default: z--; // expected-error {{statement not in switch}}
@@ -375,3 +375,13 @@ void switch_on_ExtendedEnum1(enum ExtendedEnum1 e) {
}
}
+void PR11778(char c, int n, long long ll) {
+ // Do not reject this; we don't have duplicate case values because we
+ // check for duplicates in the promoted type.
+ switch (c) case 1: case 257: ; // expected-warning {{overflow}}
+
+ switch (n) case 0x100000001LL: case 1: ; // expected-warning {{overflow}} expected-error {{duplicate}} expected-note {{previous}}
+ switch ((int)ll) case 0x100000001LL: case 1: ; // expected-warning {{overflow}} expected-error {{duplicate}} expected-note {{previous}}
+ switch ((long long)n) case 0x100000001LL: case 1: ;
+ switch (ll) case 0x100000001LL: case 1: ;
+}
OpenPOWER on IntegriCloud