aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/call.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index 0ba0e19..b00334d 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -7291,6 +7291,14 @@ build_temp (tree expr, tree type, int flags,
&& !type_has_nontrivial_copy_init (TREE_TYPE (expr)))
return get_target_expr_sfinae (expr, complain);
+ /* In decltype, we might have decided not to wrap this call in a TARGET_EXPR.
+ But it turns out to be a subexpression, so perform temporary
+ materialization now. */
+ if (TREE_CODE (expr) == CALL_EXPR
+ && CLASS_TYPE_P (type)
+ && same_type_ignoring_top_level_qualifiers_p (type, TREE_TYPE (expr)))
+ expr = build_cplus_new (type, expr, complain);
+
savew = warningcount + werrorcount, savee = errorcount;
releasing_vec args (make_tree_vector_single (expr));
expr = build_special_member_call (NULL_TREE, complete_ctor_identifier,