summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp0x/constexpr-trivial1.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/g++.dg/cpp0x/constexpr-trivial1.C')
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/constexpr-trivial1.C20
1 files changed, 20 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-trivial1.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-trivial1.C
new file mode 100644
index 00000000000..f4b74a7eec9
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-trivial1.C
@@ -0,0 +1,20 @@
+// PR c++/70139
+// { dg-options "-fno-elide-constructors" }
+// { dg-do compile { target c++11 } }
+
+template<class T, class U>
+struct A
+{
+ T a;
+ U b;
+ constexpr A () : a (), b () { }
+ constexpr A (const T &x, const U &y) : a (x), b (y) { }
+};
+struct B
+{
+ constexpr B (const bool x) : c (x) {}
+ constexpr bool operator!= (const B x) const { return c != x.c; }
+ bool c;
+};
+constexpr static A<B, B*> d[] = { { B (true), nullptr }, { B (false), nullptr } };
+static_assert (d[0].a != d[1].a, "");