https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124575
--- Comment #1 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:d51a78f7a8f3449f89060ee1373a9ed7d99480bb commit r16-8235-gd51a78f7a8f3449f89060ee1373a9ed7d99480bb Author: Marek Polacek <[email protected]> Date: Thu Mar 19 09:33:15 2026 -0400 c++/reflection: ICE with lifetime extension of consteval-only [PR124575] Here we ICE in output_constant because we attempt to emit the temporary created for lifetime extension of a consteval-only expression. Like other consteval-only variables, the temporary also has to be marked DECL_EXTERNAL so that we don't emit it. I tried to do the setting in make_temporary_var_for_ref_to_temp, but then we ICE in set_decl_context_in_fn. PR c++/124575 gcc/cp/ChangeLog: * call.cc (set_up_extended_ref_temp): If var is consteval-only, mark it DECL_EXTERNAL. gcc/testsuite/ChangeLog: * g++.dg/reflect/expr16.C: New test. Reviewed-by: Jason Merrill <[email protected]>
