]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Revert "c++: friend with redundant qualification [PR41723]"
authorJason Merrill <jason@redhat.com>
Thu, 12 May 2022 21:08:52 +0000 (17:08 -0400)
committerJason Merrill <jason@redhat.com>
Thu, 12 May 2022 21:40:28 +0000 (17:40 -0400)
PR c++/102300
PR c++/41723

The patch for PR41723 caused PR102300 on trunk; let's just back it out on
the 10 branch.

This reverts commit e41d610696b81e72d1d06db176b281424e32fc23.

gcc/testsuite/ChangeLog:

* g++.dg/template/nested7.C: New test.

gcc/cp/parser.c
gcc/testsuite/g++.dg/template/friend71.C [deleted file]
gcc/testsuite/g++.dg/template/nested7.C [new file with mode: 0644]

index 1499bf5d258bd7c4a5c638537fedc0239eeae668..4c36cbeeb489cc973cf8debb7bf526c2c79b436c 100644 (file)
@@ -23674,7 +23674,7 @@ cp_parser_class_name (cp_parser *parser,
   /* Any name names a type if we're following the `typename' keyword
      in a qualified name where the enclosing scope is type-dependent.  */
   typename_p = (typename_keyword_p && scope && TYPE_P (scope)
-               && dependent_scope_p (scope));
+               && dependent_type_p (scope));
   /* Handle the common case (an identifier, but not a template-id)
      efficiently.  */
   if (token->type == CPP_NAME
diff --git a/gcc/testsuite/g++.dg/template/friend71.C b/gcc/testsuite/g++.dg/template/friend71.C
deleted file mode 100644 (file)
index 939ea6b..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-// PR c++/41723
-
-template<class T>
-class C {
-  template <class U> class D {};
-
-  friend class C::D<int>;
-};
diff --git a/gcc/testsuite/g++.dg/template/nested7.C b/gcc/testsuite/g++.dg/template/nested7.C
new file mode 100644 (file)
index 0000000..3a5930c
--- /dev/null
@@ -0,0 +1,12 @@
+// PR c++/102300
+
+template<typename T>
+struct holder
+{
+  template<typename F> struct fn {};
+
+  struct t1 : fn<T> {};                      // pass
+  struct t2 : holder<T >::fn<T> {};          // fail
+  struct t3 : holder<T >::template fn<T> {}; // fail
+  struct t4 : holder<T*>::template fn<T> {}; // pass
+};