aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/init.c2
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/union4.C17
4 files changed, 27 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index e7d75e8..cf21fd6 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,8 @@
+2011-04-18 Jason Merrill <jason@redhat.com>
+
+ PR c++/48537
+ * init.c (build_value_init): Handle UNION_TYPE the same.
+
2011-04-18 Jakub Jelinek <jakub@redhat.com>
PR c++/48632
diff --git a/gcc/cp/init.c b/gcc/cp/init.c
index 3280d9b..04d2bb2 100644
--- a/gcc/cp/init.c
+++ b/gcc/cp/init.c
@@ -343,7 +343,7 @@ build_value_init (tree type, tsubst_flags_t complain)
NULL, type, LOOKUP_NORMAL,
complain),
complain);
- else if (TREE_CODE (type) != UNION_TYPE && TYPE_NEEDS_CONSTRUCTING (type))
+ else if (TYPE_NEEDS_CONSTRUCTING (type))
{
/* This is a class that needs constructing, but doesn't have
a user-provided constructor. So we need to zero-initialize
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 96fb5c5..b8e8909 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2011-04-18 Jason Merrill <jason@redhat.com>
+
+ * g++.dg/cpp0x/union4.C: New.
+
2011-04-18 Jakub Jelinek <jakub@redhat.com>
PR middle-end/48661
diff --git a/gcc/testsuite/g++.dg/cpp0x/union4.C b/gcc/testsuite/g++.dg/cpp0x/union4.C
new file mode 100644
index 0000000..0705047
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/union4.C
@@ -0,0 +1,17 @@
+// PR c++/48537
+// { dg-options -std=c++0x }
+
+struct SFoo
+{
+ SFoo() =delete; // { dg-error "declared" }
+};
+
+union UFoo // { dg-error "deleted" }
+{
+ SFoo foo;
+};
+
+int main()
+{
+ UFoo(); // { dg-error "deleted" }
+}