Commit 6a9263f7 by Jason Merrill Committed by Jason Merrill

re PR c++/66383 (ICE in gimplify_expr on this passed in inline initialization)

	PR c++/66383
	* tree.c (replace_placeholders_r): Handle placeholders for an
	outer object.
	* typeck2.c (store_init_value): Only replace_placeholders for
	objects of class type.

From-SVN: r224282
parent fe2bef71
2015-06-09 Jason Merrill <jason@redhat.com>
PR c++/66383
* tree.c (replace_placeholders_r): Handle placeholders for an
outer object.
* typeck2.c (store_init_value): Only replace_placeholders for
objects of class type.
2015-06-08 Andrew MacLeod <amacleod@redhat.com> 2015-06-08 Andrew MacLeod <amacleod@redhat.com>
* call.c : Adjust include files. * call.c : Adjust include files.
......
...@@ -2552,15 +2552,15 @@ replace_placeholders_r (tree* t, int* walk_subtrees, void* data_) ...@@ -2552,15 +2552,15 @@ replace_placeholders_r (tree* t, int* walk_subtrees, void* data_)
switch (TREE_CODE (*t)) switch (TREE_CODE (*t))
{ {
case PLACEHOLDER_EXPR: case PLACEHOLDER_EXPR:
gcc_assert (same_type_ignoring_top_level_qualifiers_p {
(TREE_TYPE (*t), TREE_TYPE (obj))); tree x = obj;
*t = obj; for (; !(same_type_ignoring_top_level_qualifiers_p
*walk_subtrees = false; (TREE_TYPE (*t), TREE_TYPE (x)));
break; x = TREE_OPERAND (x, 0))
gcc_assert (TREE_CODE (x) == COMPONENT_REF);
case TARGET_EXPR: *t = x;
/* Don't mess with placeholders in an unrelated object. */ *walk_subtrees = false;
*walk_subtrees = false; }
break; break;
case CONSTRUCTOR: case CONSTRUCTOR:
......
...@@ -836,7 +836,7 @@ store_init_value (tree decl, tree init, vec<tree, va_gc>** cleanups, int flags) ...@@ -836,7 +836,7 @@ store_init_value (tree decl, tree init, vec<tree, va_gc>** cleanups, int flags)
TREE_CONSTANT (decl) = const_init && decl_maybe_constant_var_p (decl); TREE_CONSTANT (decl) = const_init && decl_maybe_constant_var_p (decl);
} }
if (cxx_dialect >= cxx14) if (cxx_dialect >= cxx14 && CLASS_TYPE_P (strip_array_types (type)))
/* Handle aggregate NSDMI in non-constant initializers, too. */ /* Handle aggregate NSDMI in non-constant initializers, too. */
value = replace_placeholders (value, decl); value = replace_placeholders (value, decl);
......
// PR c++/66383
// { dg-do compile { target c++11 } }
namespace N1 {
struct B;
struct A
{
B* b;
A(B* b);
};
struct B
{
A a{ this };
};
A::A(B* b): b{ b } {}
void foo()
{
auto b = B{};
}
}
namespace N2 {
struct B;
struct A
{
B* b;
};
struct B
{
A a{ this };
};
void foo()
{
auto b = B{};
}
}
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