In a couple of places in build_over_call we were calling cp_stabilize_reference but only using the result once, so it isn't needed.
Tested x86_64-pc-linux-gnu, applying to trunk. gcc/cp/ChangeLog 2020-05-18 Jason Merrill <ja...@redhat.com> * call.c (build_over_call): Remove unnecessary cp_stabilize_reference. --- gcc/cp/call.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/gcc/cp/call.c b/gcc/cp/call.c index b96bc06a364..0b0eaa65ad8 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -9003,8 +9003,7 @@ build_over_call (struct z_candidate *cand, int flags, tsubst_flags_t complain) else if ((trivial || TREE_CODE (arg) == TARGET_EXPR) && !unsafe) { - tree to = cp_stabilize_reference (cp_build_fold_indirect_ref (fa)); - + tree to = cp_build_fold_indirect_ref (fa); val = build2 (INIT_EXPR, DECL_CONTEXT (fn), to, arg); return val; } @@ -9013,8 +9012,7 @@ build_over_call (struct z_candidate *cand, int flags, tsubst_flags_t complain) && DECL_OVERLOADED_OPERATOR_IS (fn, NOP_EXPR) && trivial_fn_p (fn)) { - tree to = cp_stabilize_reference - (cp_build_fold_indirect_ref (argarray[0])); + tree to = cp_build_fold_indirect_ref (argarray[0]); tree type = TREE_TYPE (to); tree as_base = CLASSTYPE_AS_BASE (type); tree arg = argarray[1]; @@ -9043,6 +9041,7 @@ build_over_call (struct z_candidate *cand, int flags, tsubst_flags_t complain) tree array_type, alias_set; arg2 = TYPE_SIZE_UNIT (as_base); + to = cp_stabilize_reference (to); arg0 = cp_build_addr_expr (to, complain); array_type = build_array_type (unsigned_char_type_node, base-commit: 100fdb1f09b484ef100b638b28a260857d85f9dd -- 2.18.1