This commit is contained in:
Marek Polacek 2023-12-18 15:28:38 -05:00 committed by root
parent 3a113aee38
commit ffc019b858
3 changed files with 6 additions and 112 deletions

4
.gcc.metadata Normal file
View File

@ -0,0 +1,4 @@
0a97442f00d814b259be1da178f627b0e3690051 gcc-11.4.1-20231218.tar.xz
bbffc5a2b05e4f0c97e882f96c448504491dc4ed isl-0.18.tar.bz2
6ec33952e824e837fef0e829c93d39d6a507082f newlib-cygwin-50e2a63b04bdd018484605fbb954fd1bd5147fa0.tar.xz
0e0c6f8d68ab0878f02287ac082c1077c831cd81 nvptx-tools-5f6f343a302d620b0868edab376c00b15741e39e.tar.xz

View File

@ -294,8 +294,7 @@ Patch30: gcc11-testsuite-fixes.patch
Patch32: gcc11-testsuite-fixes-2.patch
Patch33: gcc11-pr111039.patch
Patch34: gcc11-pr111070.patch
Patch35: gcc11-pr106310.patch
Patch36: gcc11-testsuite-aarch64-add-fno-stack-protector.patch
Patch35: gcc11-testsuite-aarch64-add-fno-stack-protector.patch
Patch100: gcc11-fortran-fdec-duplicates.patch
Patch101: gcc11-fortran-flogical-as-integer.patch
@ -895,8 +894,7 @@ mark them as cross compiled.
%patch32 -p1 -b .testsuite2~
%patch33 -p1 -b .pr111039~
%patch34 -p1 -b .pr111070~
%patch35 -p1 -b .pr106310~
%patch36 -p1 -b .testsuite3~
%patch35 -p1 -b .testsuite3~
%if 0%{?rhel} >= 9
%patch100 -p1 -b .fortran-fdec-duplicates~

View File

@ -1,108 +0,0 @@
commit 506d5f399bef7f2d8c48fd83d853c6ff7811a226
Author: Jason Merrill <jason@redhat.com>
Date: Wed Jul 26 10:39:34 2023 -0400
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.
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 8287934a679..8df715596eb 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -2610,7 +2610,7 @@ static tree cp_parser_objc_struct_declaration
/* Utility Routines */
static cp_expr cp_parser_lookup_name
- (cp_parser *, tree, enum tag_types, bool, bool, bool, tree *, location_t);
+ (cp_parser *, tree, enum tag_types, int, bool, bool, tree *, location_t);
static tree cp_parser_lookup_name_simple
(cp_parser *, tree, location_t);
static tree cp_parser_maybe_treat_template_as_class
@@ -17748,7 +17748,7 @@ cp_parser_template_name (cp_parser* parser,
/* Look up the name. */
decl = cp_parser_lookup_name (parser, identifier,
tag_type,
- /*is_template=*/true,
+ /*is_template=*/1 + template_keyword_p,
/*is_namespace=*/false,
check_dependency_p,
/*ambiguous_decls=*/NULL,
@@ -29254,7 +29254,7 @@ prefer_type_arg (tag_types tag_type)
refer to types are ignored.
If IS_TEMPLATE is TRUE, bindings that do not refer to templates are
- ignored.
+ ignored. If IS_TEMPLATE IS 2, the 'template' keyword was specified.
If IS_NAMESPACE is TRUE, bindings that do not refer to namespaces
are ignored.
@@ -29269,7 +29269,7 @@ prefer_type_arg (tag_types tag_type)
static cp_expr
cp_parser_lookup_name (cp_parser *parser, tree name,
enum tag_types tag_type,
- bool is_template,
+ int is_template,
bool is_namespace,
bool check_dependency,
tree *ambiguous_decls,
@@ -29454,7 +29454,14 @@ cp_parser_lookup_name (cp_parser *parser, tree name,
else
decl = NULL_TREE;
- if (!decl)
+ /* If we didn't find a member and have dependent bases, the member lookup
+ is now dependent. */
+ if (!dep && !decl && any_dependent_bases_p (object_type))
+ dep = true;
+
+ if (dep && is_template == 2)
+ /* The template keyword specifies a dependent template. */;
+ else if (!decl)
/* Look it up in the enclosing context. DR 141: When looking for a
template-name after -> or ., only consider class templates. */
decl = lookup_name (name, is_namespace ? LOOK_want::NAMESPACE
diff --git a/gcc/testsuite/g++.dg/template/template-keyword4.C b/gcc/testsuite/g++.dg/template/template-keyword4.C
new file mode 100644
index 00000000000..a7ab9bb8ca6
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/template-keyword4.C
@@ -0,0 +1,18 @@
+// PR c++/106310
+
+template <class T>
+struct set{};
+
+template< typename T >
+struct Base
+{
+ template< int > int set(T const &);
+};
+
+template< typename T >
+struct Derived : Base< T >
+{
+ void f(T const &arg) {
+ this->template set< 0 >(arg);
+ }
+};