Merge 2 separate throw_exception calls in can_substitute.

This commit is contained in:
Jakub Jelinek
2026-01-07 12:34:18 +01:00
committed by Marek Polacek
parent a5c94b4653
commit 98cbbd7b53

View File

@@ -5317,17 +5317,13 @@ eval_can_substitute (location_t loc, const constexpr_ctx *ctx,
|| eval_is_annotation (a, kind) == boolean_true_node
|| (TREE_CODE (a) == FIELD_DECL && !DECL_UNNAMED_BIT_FIELD (a))
|| kind == REFLECT_DATA_MEMBER_SPEC
|| kind == REFLECT_BASE)
|| kind == REFLECT_BASE
|| (!TYPE_P (a)
&& eval_is_template (a) == boolean_false_node
&& !has_type (a, kind)))
return throw_exception (loc, ctx,
"invalid argument to can_substitute",
fun, non_constant_p, jump_target);
else if (!TYPE_P (a) && eval_is_template (a) == boolean_false_node)
{
if (!has_type (a, kind))
return throw_exception (loc, ctx,
"invalid argument to can_substitute",
fun, non_constant_p, jump_target);
}
a = resolve_nondeduced_context (a, tf_warning_or_error);
TREE_VEC_ELT (rvec, i) = a;
}