re PR c++/58639 (ICE on self-referential struct member)

PR c++/58639
	* call.c (build_aggr_conv): Reject value-initialization of reference.

From-SVN: r207183
This commit is contained in:
Jason Merrill 2014-01-28 08:40:06 -05:00 committed by Jason Merrill
parent e913fde7c5
commit 8e45c9da33
3 changed files with 20 additions and 0 deletions

View File

@ -1,3 +1,8 @@
2014-01-27 Jason Merrill <jason@redhat.com>
PR c++/58639
* call.c (build_aggr_conv): Reject value-initialization of reference.
2013-10-25 Tom de Vries <tom@codesourcery.com>
PR c++/58282

View File

@ -894,6 +894,9 @@ build_aggr_conv (tree type, tree ctor, int flags)
if (i < CONSTRUCTOR_NELTS (ctor))
val = CONSTRUCTOR_ELT (ctor, i)->value;
else if (TREE_CODE (ftype) == REFERENCE_TYPE)
/* Value-initialization of reference is ill-formed. */
return NULL;
else
{
if (empty_ctor == NULL_TREE)

View File

@ -0,0 +1,12 @@
// PR c++/58639
// { dg-require-effective-target c++11 }
struct node {
node &parent;
};
struct vector {
node n;
};
vector v({}); // { dg-error "" }