https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127749
--- Comment #3 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The trunk branch has been updated by Marek Polacek <[email protected]>: https://gcc.gnu.org/g:4b1320d229dcbf6966aff194219eb2bbd8727801 commit r17-5516-g4b1320d229dcbf6966aff194219eb2bbd8727801 Author: Marek Polacek <[email protected]> Date: Wed Oct 7 13:16:03 2026 -0400 c++/reflection: ICE on template tree from metafunction [PR127749] Here we are in a generic lambda and want to process a call to identifier_of. Since it's a generic lambda, the lambda's operator() is a template. eval_identifier_of calls build_special_member_call which calls build_new_method_call which, in a template, creates: call = (build_min_non_dep_call_vec (call, build_min (COMPONENT_REF, TREE_TYPE (CALL_EXPR_FN (call)), orig_instance, orig_fns, NULL_TREE), orig_args)); but that can't be evaluated by cxx_eval_constant_expression that we call after process_metafunction. (In this test, we are called from tsubst_lambda_expr -> finish_if_stmt_cond -> cxx_constant_value.) Since in process_metafunction we shouldn't encounter calls that are instantiation-dependent, a simple fix is to force a non-template context. To be sure I ran a full regtest with gcc_checking_assert (!instantiation_dependent_expression_p (call)); just before the sentinel and found no problems. PR c++/127749 gcc/cp/ChangeLog: * reflect.cc (process_metafunction): Add processing_template_decl_sentinel. gcc/testsuite/ChangeLog: * g++.dg/reflect/dep17.C: New test. Reviewed-by: Jason Merrill <[email protected]>
