https://gcc.gnu.org/g:4977528639c683109dbfb9a2187000f8b2cc1ae2
commit r16-8532-g4977528639c683109dbfb9a2187000f8b2cc1ae2 Author: Yang Kun <[email protected]> Date: Wed Apr 8 15:38:31 2026 +0200 c++/reflection: Fix missing return before throw_exception gcc/cp/ChangeLog: * reflect.cc (eval_current_function): Add missing return. (eval_current_class): Likewise. Signed-off-by: Yang Kun <[email protected]> Diff: --- gcc/cp/reflect.cc | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/gcc/cp/reflect.cc b/gcc/cp/reflect.cc index a2eb5ff1486f..2baeced1e962 100644 --- a/gcc/cp/reflect.cc +++ b/gcc/cp/reflect.cc @@ -6434,8 +6434,9 @@ eval_current_function (location_t loc, const constexpr_ctx *ctx, tree scope = reflect_current_scope (loc, ctx, call, non_constant_p, "std::meta::current_function"); if (TREE_CODE (scope) != FUNCTION_DECL) - throw_exception (loc, ctx, "current scope does not represent a function", - fun, non_constant_p, jump_target); + return throw_exception (loc, ctx, + "current scope does not represent a function", + fun, non_constant_p, jump_target); return get_reflection_raw (loc, scope); } @@ -6453,9 +6454,10 @@ eval_current_class (location_t loc, const constexpr_ctx *ctx, && TYPE_P (DECL_CONTEXT (scope))) scope = DECL_CONTEXT (scope); if (!CLASS_TYPE_P (scope)) - throw_exception (loc, ctx, "current scope does not represent a class" - " nor a member function", - fun, non_constant_p, jump_target); + return throw_exception (loc, ctx, + "current scope does not represent a class" + " nor a member function", + fun, non_constant_p, jump_target); return get_reflection_raw (loc, scope); }
