https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121325
--- 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:856fae983bca6a934b74f47c7cd21e6919035fc0 commit r16-5632-g856fae983bca6a934b74f47c7cd21e6919035fc0 Author: Marek Polacek <[email protected]> Date: Mon Nov 24 17:31:22 2025 -0500 c++: fix crash with pack indexing in noexcept [PR121325] In my r15-6792 patch I added a call to tsubst in tsubst_pack_index to fully instantiate args#N in the pack. Here we are in an unevaluated context, but since the pack is a TREE_VEC, we call tsubst_template_args which has cp_evaluated at the beginning. That causes a crash because we trip on the assert in tsubst_expr/PARM_DECL: gcc_assert (cp_unevaluated_operand); because retrieve_local_specialization didn't find anything (becase there are no local_specializations yet). We can avoid the cp_evaluated by calling the new tsubst_tree_vec, which creates a new TREE_VEC and substitutes each element. PR c++/121325 gcc/cp/ChangeLog: * pt.cc (tsubst_tree_vec): New. (tsubst_pack_index): Call it. gcc/testsuite/ChangeLog: * g++.dg/cpp26/pack-indexing18.C: New test. Reviewed-by: Patrick Palka <[email protected]>
