@@ -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
new file mode 100644
@@ -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" }
+}