Commit 09262fff by Jason Merrill Committed by Jason Merrill

re PR c++/48537 (C++0x: ICE using union with non-trivial member)

	PR c++/48537
	* init.c (build_value_init): Handle UNION_TYPE the same.

From-SVN: r172678
parent 84825707
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> 2011-04-18 Jakub Jelinek <jakub@redhat.com>
PR c++/48632 PR c++/48632
......
...@@ -343,7 +343,7 @@ build_value_init (tree type, tsubst_flags_t complain) ...@@ -343,7 +343,7 @@ build_value_init (tree type, tsubst_flags_t complain)
NULL, type, LOOKUP_NORMAL, NULL, type, LOOKUP_NORMAL,
complain), complain),
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 /* This is a class that needs constructing, but doesn't have
a user-provided constructor. So we need to zero-initialize a user-provided constructor. So we need to zero-initialize
......
2011-04-18 Jason Merrill <jason@redhat.com>
* g++.dg/cpp0x/union4.C: New.
2011-04-18 Jakub Jelinek <jakub@redhat.com> 2011-04-18 Jakub Jelinek <jakub@redhat.com>
PR middle-end/48661 PR middle-end/48661
......
// 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" }
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment