aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite')
-rw-r--r--gcc/testsuite/ChangeLog7
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/pr79118.C42
2 files changed, 48 insertions, 1 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index e70200b..cdd4e1b 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2017-01-24 Nathan Sidwell <nathan@acm.org>
+
+ PR c++/79118
+ * g++.dg/cpp0x/pr79118.C: New.
+
2017-01-24 Eric Botcazou <ebotcazou@adacore.com>
* gcc.target/arm/vfp-longcall-apcs.c: New test.
@@ -305,7 +310,7 @@
2017-01-20 Nathan Sidwell <nathan@acm.org>
- PR c++/79495
+ PR c++/78495
* g++.dg/cpp1z/inh-ctor38.C: New.
2017-01-20 Marek Polacek <polacek@redhat.com>
diff --git a/gcc/testsuite/g++.dg/cpp0x/pr79118.C b/gcc/testsuite/g++.dg/cpp0x/pr79118.C
new file mode 100644
index 0000000..e7dfeb3
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/pr79118.C
@@ -0,0 +1,42 @@
+// { dg-do compile { target c++11 } }
+// { dg-additional-options { -Wno-pedantic } }
+// PR c++/79118 failure to check initialization of anonymous members.
+
+struct One
+{
+ union
+ {
+ int a;
+ int b;
+ };
+
+ constexpr One () : a(), b() {} // { dg-error "multiple" }
+ constexpr One (int) : a() {}
+ constexpr One (unsigned) : b () {}
+ constexpr One (void *) {} // { dg-error "exactly one" }
+};
+
+One a ();
+One b (0);
+One c (0u);
+One d ((void *)0);
+
+struct Two
+{
+ struct
+ {
+ int a;
+ int b;
+ };
+
+ constexpr Two () : a(), b() {}
+ constexpr Two (int) : a() {} // { dg-error "b' must be initialized" }
+ constexpr Two (unsigned) : b () {} // { dg-error "a' must be initialized" }
+ constexpr Two (void *) {} // { dg-error "a' must be initialized" }
+ // { dg-error "b' must be initialized" "" { target *-*-* } 35 }
+};
+
+Two e ();
+Two f (0);
+Two g (0u);
+Two h ((void *)0);