]> git.ipfire.org Git - thirdparty/gcc.git/commit
c++: base-specifier name lookup is type-only [PR122192]
authorPatrick Palka <ppalka@redhat.com>
Fri, 10 Oct 2025 14:25:25 +0000 (10:25 -0400)
committerPatrick Palka <ppalka@redhat.com>
Fri, 10 Oct 2025 14:25:25 +0000 (10:25 -0400)
commit49ddf362f0a7c1fdeb62f13a852a2fdec9d6fe6d
treee85ae2901ee45f9ff385ea1e974bc9bf3b192b2e
parent578c322e7d6a6b5e392d7b587179e3031b7a8daa
c++: base-specifier name lookup is type-only [PR122192]

The r13-6098 change to make TYPENAME_TYPE no longer always ignore
non-type bindings needs another exception: base-specifiers that are
represented as TYPENAME_TYPE, for which lookup must be type-only (by
[class.derived.general]/2).  This patch fixes this by giving such
TYPENAME_TYPEs a tag type of class_type rather than typename_type so
that we treat them like elaborated-type-specifiers (another type-only
lookup situation).

PR c++/122192

gcc/cp/ChangeLog:

* decl.cc (make_typename_type): Document base-specifier as
another type-only lookup case.
* parser.cc (cp_parser_class_name): Propagate tag_type to
make_typename_type instead of hardcoding typename_type.
(cp_parser_base_specifier): Pass class_type instead of
typename_type as tag_type to cp_parser_class_name.

gcc/testsuite/ChangeLog:

* g++.dg/template/dependent-base6.C: New test.

Reviewed-by: Jason Merrill <jason@redhat.com>
gcc/cp/decl.cc
gcc/cp/parser.cc
gcc/testsuite/g++.dg/template/dependent-base6.C [new file with mode: 0644]