if (DECL_HAS_VALUE_EXPR_P (t))
{
tree ve = DECL_VALUE_EXPR (t);
+ /* If the DECL_VALUE_EXPR is converted to the declared type,
+ preserve the identity so that gimplify_type_sizes works. */
+ bool nop = (TREE_CODE (ve) == NOP_EXPR);
+ if (nop)
+ ve = TREE_OPERAND (ve, 0);
ve = tsubst_expr (ve, args, complain, in_decl,
/*constant_expression_p=*/false);
if (REFERENCE_REF_P (ve))
gcc_assert (TREE_CODE (type) == REFERENCE_TYPE);
ve = TREE_OPERAND (ve, 0);
}
+ if (nop)
+ ve = build_nop (type, ve);
+ else
+ gcc_checking_assert (TREE_TYPE (ve) == type);
SET_DECL_VALUE_EXPR (r, ve);
}
if (CP_DECL_THREAD_LOCAL_P (r)