]> git.ipfire.org Git - thirdparty/gcc.git/commit
c++: member vs global template [PR106310]
authorJason Merrill <jason@redhat.com>
Wed, 26 Jul 2023 14:39:34 +0000 (10:39 -0400)
committerJason Merrill <jason@redhat.com>
Mon, 11 Sep 2023 22:10:51 +0000 (18:10 -0400)
commit506d5f399bef7f2d8c48fd83d853c6ff7811a226
tree29404fff4411237289b6cb85340957cc4c262ac8
parent0d7e5f90597167c36c7816f5bcf689472e8b1940
c++: member vs global template [PR106310]

For backward compatibility we still want to allow patterns like
this->A<T>::foo, but the template keyword in a qualified name is
specifically to specify that a dependent name is a template, so don't look
in the enclosing scope at all.

Also fix handling of dependent bases: if member lookup in the current
instantiation fails and we have dependent bases, the lookup is dependent.
We were already handling that for the case where lookup in the enclosing
scope also fails, but we also want it to affect that lookup itself.

PR c++/106310

gcc/cp/ChangeLog:

* parser.c (cp_parser_template_name): Skip non-member
lookup after the template keyword.
(cp_parser_lookup_name): Pass down template_keyword_p.

gcc/testsuite/ChangeLog:

* g++.dg/template/template-keyword4.C: New test.
gcc/cp/parser.c
gcc/testsuite/g++.dg/template/template-keyword4.C [new file with mode: 0644]