summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp0x/constexpr-switch2.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/g++.dg/cpp0x/constexpr-switch2.C')
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/constexpr-switch2.C23
1 files changed, 23 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-switch2.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-switch2.C
new file mode 100644
index 000000000..55cf2ad7c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-switch2.C
@@ -0,0 +1,23 @@
+// Test for constexpr conversion in case context
+// { dg-options -std=c++0x }
+
+enum class E { e1, e2 };
+
+struct A
+{
+ E e;
+ constexpr operator E() { return e; }
+ constexpr A(E e): e(e) { }
+};
+
+E e;
+
+int main()
+{
+ switch (e)
+ {
+ case A(E::e1):
+ case A(E::e2):
+ ;
+ }
+}