Commit 99d14de6 by Jason Merrill Committed by Jason Merrill

re PR c++/61046 (ICE in lookup_field_1, at cp/search.c:384)

	PR c++/61046
	* decl.c (reshape_init_class): Handle un-folded
	constant-expressions.

From-SVN: r211160
parent cfc8dced
2014-06-02 Jason Merrill <jason@redhat.com>
PR c++/61046
* decl.c (reshape_init_class): Handle un-folded
constant-expressions.
PR c++/61134
* pt.c (pack_deducible_p): Handle canonicalization.
......
......@@ -5294,7 +5294,12 @@ reshape_init_class (tree type, reshape_iter *d, bool first_initializer_p,
if (d->cur->index == error_mark_node)
return error_mark_node;
if (TREE_CODE (d->cur->index) == INTEGER_CST)
if (TREE_CODE (d->cur->index) == FIELD_DECL)
/* We already reshaped this. */
gcc_assert (d->cur->index == field);
else if (TREE_CODE (d->cur->index) == IDENTIFIER_NODE)
field = lookup_field_1 (type, d->cur->index, /*want_type=*/false);
else
{
if (complain & tf_error)
error ("%<[%E] =%> used in a GNU-style designated initializer"
......@@ -5302,12 +5307,6 @@ reshape_init_class (tree type, reshape_iter *d, bool first_initializer_p,
return error_mark_node;
}
if (TREE_CODE (d->cur->index) == FIELD_DECL)
/* We already reshaped this. */
gcc_assert (d->cur->index == field);
else
field = lookup_field_1 (type, d->cur->index, /*want_type=*/false);
if (!field || TREE_CODE (field) != FIELD_DECL)
{
if (complain & tf_error)
......
// PR c++/61046
struct A
{
int ary[4];
};
const int i = 0;
A bar = { [i] = 0 }; // { dg-error "designated" }
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