https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106311
--- Comment #2 from CVS 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:2333b58c9892667545d0c2c3ecd2d7b947197511 commit r13-1841-g2333b58c9892667545d0c2c3ecd2d7b947197511 Author: Marek Polacek <pola...@redhat.com> Date: Fri Jul 15 09:51:50 2022 -0400 c++: ICE with erroneous template redeclaration [PR106311] Here we ICE trying to get DECL_SOURCE_LOCATION of the parm that happens to be error_mark_node in this ill-formed test. I kept running into this while reducing code, so it'd be good to have it fixed. PR c++/106311 gcc/cp/ChangeLog: * pt.cc (redeclare_class_template): Check DECL_P before accessing DECL_SOURCE_LOCATION. gcc/testsuite/ChangeLog: * g++.dg/template/redecl5.C: New test.