Commit 7599760d by Jason Merrill Committed by Jason Merrill

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
parent 2ed4c029
2015-06-16 Jason Merrill <jason@redhat.com> 2015-06-16 Jason Merrill <jason@redhat.com>
PR c++/66536
* tree.c (replace_placeholders_r) [CONSTRUCTOR]: Handle type
mismatch.
PR c++/58063 PR c++/58063
* tree.c (bot_manip): Remap SAVE_EXPR. * tree.c (bot_manip): Remap SAVE_EXPR.
......
...@@ -2599,7 +2599,12 @@ replace_placeholders_r (tree* t, int* walk_subtrees, void* data_) ...@@ -2599,7 +2599,12 @@ replace_placeholders_r (tree* t, int* walk_subtrees, void* data_)
if (TREE_CODE (*valp) == CONSTRUCTOR if (TREE_CODE (*valp) == CONSTRUCTOR
&& AGGREGATE_TYPE_P (type)) && 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) if (TREE_CODE (*valp) == TARGET_EXPR)
valp = &TARGET_EXPR_INITIAL (*valp); valp = &TARGET_EXPR_INITIAL (*valp);
} }
......
// PR c++/66536
// { dg-do compile { target c++14 } }
template <typename> struct make_impl;
struct Tuple;
template <> struct make_impl<Tuple> {};
struct A {
template <typename X> auto operator()(X) { return make_impl<Tuple>(); }
};
template <typename> A make;
template <typename _Tp, int> struct array { _Tp _M_elems; };
struct Tracked {
Tracked(int);
};
struct B {
Tracked tracker{0};
};
template <int> using ct_eq = B;
auto eq_arrays = make<Tuple>(array<ct_eq<0>, 0>{});
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