[Bug c++/123186] [16 Regression] internal compiler error: in lookup_member, at cp/search.cc:1197 since r16-6145
cvs-commit at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Dec 18 15:42:01 GMT 2025
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123186
--- Comment #8 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:
https://gcc.gnu.org/g:1c555ba67a34ced2460a065eac05ae2e2693ca4d
commit r16-6248-g1c555ba67a34ced2460a065eac05ae2e2693ca4d
Author: Jakub Jelinek <jakub@redhat.com>
Date: Thu Dec 18 16:41:10 2025 +0100
c++: Fix up recent cp_parser_template_id regression [PR123186]
On Fri, Dec 12, 2025 at 09:39:18AM -0500, Patrick Palka wrote:
> + TREE_TYPE (templ)
> + = build_typename_type (TYPE_CONTEXT (TREE_TYPE (templ)),
> + TYPE_NAME (TREE_TYPE (templ)),
> + fullname,
> + get_typename_type_tag (TREE_TYPE (templ)));
> template_id = templ;
> }
> else
This change causes ICE e.g. on the following testcase.
The problem is that build_typename_type expects IDENTIFIER_NODE as the
second argument, e.g. it uses it as
tree d = build_decl (input_location, TYPE_DECL, name, t);
argument. But TYPE_NAME doesn't have to be an IDENTIFIER_NODE, it can
be a TYPE_DECL too and when we build a TYPE_DECL with TYPE_DECL as
DECL_NAME, it breaks all kinds of assumptions everywhere in the FE as well
as middle-end.
Fixed by using TYPE_IDENTIFIER instead.
2025-12-18 Jakub Jelinek <jakub@redhat.com>
PR c++/123186
* parser.cc (cp_parser_template_id): Use TYPE_IDENTIFIER instead of
TYPE_NAME in second build_typename_type argument.
* g++.dg/template/crash133.C: New test.
More information about the Gcc-bugs
mailing list