summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp0x/nsdmi-union1.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/g++.dg/cpp0x/nsdmi-union1.C')
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/nsdmi-union1.C25
1 files changed, 25 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/cpp0x/nsdmi-union1.C b/gcc/testsuite/g++.dg/cpp0x/nsdmi-union1.C
new file mode 100644
index 00000000000..11bdd88eea2
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/nsdmi-union1.C
@@ -0,0 +1,25 @@
+// PR c++/52377
+// { dg-do run { target c++11 } }
+
+union Test
+{
+ int a{4};
+};
+
+union B
+{
+ int i = 42;
+ double d;
+ B() = default;
+ B(double d): d(d) { }
+};
+
+int main()
+{
+ Test t;
+ B b;
+ B b2(4.2);
+
+ if (t.a != 4 || b.i != 42 || b2.d != 4.2)
+ __builtin_abort();
+}