diff options
author | Jason Merrill <jason@redhat.com> | 2015-06-16 15:29:19 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2015-06-16 15:29:19 -0400 |
commit | 7599760d235cf31c8c6013b62fb41cc810b514b6 (patch) | |
tree | 88c3e7c999851944ff1fdca5df950053679d27cb /gcc/cp/tree.c | |
parent | 2ed4c0297fb2ece975c69d17e02eac8d8b62325b (diff) | |
download | gcc-7599760d235cf31c8c6013b62fb41cc810b514b6.zip gcc-7599760d235cf31c8c6013b62fb41cc810b514b6.tar.gz gcc-7599760d235cf31c8c6013b62fb41cc810b514b6.tar.bz2 |
re PR c++/66536 (ICE in build_ctor_subob_ref, at cp/tree.c:2534)
PR c++/66536
* tree.c (replace_placeholders_r) [CONSTRUCTOR]: Handle type
mismatch.
From-SVN: r224534
Diffstat (limited to 'gcc/cp/tree.c')
-rw-r--r-- | gcc/cp/tree.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index a52e6f4..e6442cd 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -2599,7 +2599,12 @@ replace_placeholders_r (tree* t, int* walk_subtrees, void* data_) if (TREE_CODE (*valp) == CONSTRUCTOR && AGGREGATE_TYPE_P (type)) { - subob = build_ctor_subob_ref (ce->index, type, obj); + /* If we're looking at the initializer for OBJ, then build + a sub-object reference. If we're looking at an + initializer for another object, just pass OBJ down. */ + if (same_type_ignoring_top_level_qualifiers_p + (TREE_TYPE (*t), TREE_TYPE (obj))) + subob = build_ctor_subob_ref (ce->index, type, obj); if (TREE_CODE (*valp) == TARGET_EXPR) valp = &TARGET_EXPR_INITIAL (*valp); } |