summaryrefslogtreecommitdiffstats
path: root/test/SemaCXX/switch.cpp
diff options
context:
space:
mode:
authorrdivacky <rdivacky@FreeBSD.org>2010-05-27 15:17:06 +0000
committerrdivacky <rdivacky@FreeBSD.org>2010-05-27 15:17:06 +0000
commit53992adde3eda3ccf9da63bc7e45673f043de18f (patch)
tree3558f327a6f9ab59c5d7a06528d84e1560445247 /test/SemaCXX/switch.cpp
parent7e411337c0ed226dace6e07f1420486768161308 (diff)
downloadFreeBSD-src-53992adde3eda3ccf9da63bc7e45673f043de18f.zip
FreeBSD-src-53992adde3eda3ccf9da63bc7e45673f043de18f.tar.gz
Update clang to r104832.
Diffstat (limited to 'test/SemaCXX/switch.cpp')
-rw-r--r--test/SemaCXX/switch.cpp19
1 files changed, 18 insertions, 1 deletions
diff --git a/test/SemaCXX/switch.cpp b/test/SemaCXX/switch.cpp
index c256960..fc13630 100644
--- a/test/SemaCXX/switch.cpp
+++ b/test/SemaCXX/switch.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify -Wswitch-enum %s
void test() {
bool x = true;
@@ -40,3 +40,20 @@ void x3(C &c) {
switch (c) { // expected-error{{incomplete class type}}
}
}
+
+namespace test3 {
+ enum En { A, B, C };
+ template <En how> void foo() {
+ int x = 0, y = 5;
+
+ switch (how) { //expected-warning {{no case matching constant switch condition '2'}}
+ case A: x *= y; break;
+ case B: x += y; break;
+ // No case for C, but it's okay because we have a constant condition.
+ }
+ }
+
+ template void foo<A>();
+ template void foo<B>();
+ template void foo<C>(); //expected-note {{in instantiation}}
+}
OpenPOWER on IntegriCloud