From 98cbbd7b5301bd8b30868c94b2a50010870c83eb Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Wed, 7 Jan 2026 12:34:18 +0100 Subject: [PATCH] Merge 2 separate throw_exception calls in can_substitute. --- gcc/cp/reflect.cc | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/gcc/cp/reflect.cc b/gcc/cp/reflect.cc index 6a1e7d58728..7ea66e376d8 100644 --- a/gcc/cp/reflect.cc +++ b/gcc/cp/reflect.cc @@ -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; }