https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117898
--- Comment #2 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The trunk branch has been updated by Marek Polacek <mpola...@gcc.gnu.org>: https://gcc.gnu.org/g:afeef7f0d3537cd978931a5afcbd3d91c144bfeb commit r15-5955-gafeef7f0d3537cd978931a5afcbd3d91c144bfeb Author: Marek Polacek <pola...@redhat.com> Date: Wed Dec 4 16:58:59 2024 -0500 c++: ICE with pack indexing empty pack [PR117898] Here we ICE with a partially-substituted pack indexing. The pack expanded to an empty pack, which we can't index. It seems reasonable to detect this case in tsubst_pack_index, even before we substitute the index. Other erroneous cases can wait until pack_index_element where we have the index. PR c++/117898 gcc/cp/ChangeLog: * pt.cc (tsubst_pack_index): Detect indexing an empty pack. gcc/testsuite/ChangeLog: * g++.dg/cpp26/pack-indexing2.C: Adjust. * g++.dg/cpp26/pack-indexing12.C: New test.