summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp0x/constexpr-ice.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/g++.dg/cpp0x/constexpr-ice.C')
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/constexpr-ice.C11
1 files changed, 11 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-ice.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-ice.C
new file mode 100644
index 000000000..3b72484a0
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-ice.C
@@ -0,0 +1,11 @@
+// We used to crash on this instead of giving a decent error.
+// { dg-options -std=c++0x }
+
+struct A { int i; };
+
+struct B {
+ const A *a;
+ constexpr B(const A& a): a(&a) { }
+};
+
+constexpr B b{A{42}}; // { dg-error "constant|expansion" }