[Bug c++/122958] [13/14/15/16 Regression] internal compiler error: tree check: accessed elt 3 of 'tree_vec' with 2 elts in tsubst, at cp/pt.cc:16806
cvs-commit at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Dec 23 13:58:08 GMT 2025
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122958
--- Comment #11 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Jason Merrill <jason@gcc.gnu.org>:
https://gcc.gnu.org/g:61eb73a6396fd63b02f208e4288f694c849e9428
commit r16-6365-g61eb73a6396fd63b02f208e4288f694c849e9428
Author: Egas Ribeiro <egas.g.ribeiro@gmail.com>
Date: Mon Dec 22 22:30:12 2025 +0000
c++: Fix ICE on partial specialization redeclaration with mismatched
parameters [PR122958]
When a partial specialization was redeclared with different template
parameters, maybe_new_partial_specialization was incorrectly treating it
as the same specialization by only comparing template argument lists
without comparing template-heads. This caused an ICE when the
redeclaration had different template parameters.
Per [temp.spec.partial.general]/2, two partial specializations declare
the same entity only if they have equivalent template-heads and
template argument lists.
Fix by comparing template parameter lists (template-heads) in addition
to template argument lists when checking for existing specializations,
and removing flag_concepts to provide diagnostics before c++20 for the
testcase.
PR c++/122958
gcc/cp/ChangeLog:
* pt.cc (maybe_new_partial_specialization): Compare template
parameter lists when checking for existing specializations and
remove flag_concepts check.
gcc/testsuite/ChangeLog:
* g++.dg/cpp2a/partial-spec-redecl.C: New test.
Signed-off-by: Egas Ribeiro <egas.g.ribeiro@gmail.com>
Reviewed-by: Jason Merrill <jason@redhat.com>
More information about the Gcc-bugs
mailing list