summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/FixIt/fixit-cxx0x.cpp14
-rw-r--r--clang/test/SemaCXX/switch-0x.cpp11
-rw-r--r--clang/test/SemaCXX/switch.cpp20
3 files changed, 45 insertions, 0 deletions
diff --git a/clang/test/FixIt/fixit-cxx0x.cpp b/clang/test/FixIt/fixit-cxx0x.cpp
new file mode 100644
index 00000000000..2c783bc2e33
--- /dev/null
+++ b/clang/test/FixIt/fixit-cxx0x.cpp
@@ -0,0 +1,14 @@
+/* RUN: clang-cc -std=c++0x -fixit %s -o - | clang-cc -x c++ -std=c++0x -
+ */
+
+/* This is a test of the various code modification hints that only
+ apply in C++0x. */
+struct A {
+ explicit operator int(); // expected-note{{conversion to integral type}}
+};
+
+void x() {
+ switch(A()) { // expected-error{{explicit conversion to}}
+ }
+}
+
diff --git a/clang/test/SemaCXX/switch-0x.cpp b/clang/test/SemaCXX/switch-0x.cpp
new file mode 100644
index 00000000000..c1f6bd9d19a
--- /dev/null
+++ b/clang/test/SemaCXX/switch-0x.cpp
@@ -0,0 +1,11 @@
+// RUN: clang-cc -fsyntax-only -verify -std=c++0x %s
+
+// PR5518
+struct A {
+ explicit operator int(); // expected-note{{conversion to integral type}}
+};
+
+void x() {
+ switch(A()) { // expected-error{{explicit conversion to}}
+ }
+}
diff --git a/clang/test/SemaCXX/switch.cpp b/clang/test/SemaCXX/switch.cpp
index b22adb74957..2f2f2a9587a 100644
--- a/clang/test/SemaCXX/switch.cpp
+++ b/clang/test/SemaCXX/switch.cpp
@@ -13,3 +13,23 @@ void test() {
break;
}
}
+
+// PR5518
+struct A {
+ operator int(); // expected-note{{conversion to integral type}}
+};
+
+void x() {
+ switch(A()) {
+ }
+}
+
+enum E { e1, e2 };
+struct B : A {
+ operator E() const; // expected-note{{conversion to enumeration type}}
+};
+
+void x2() {
+ switch (B()) { // expected-error{{multiple conversions}}
+ }
+}
OpenPOWER on IntegriCloud