public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r10-9851] c++: friend with redundant qualification [PR41723]
@ 2021-05-20 21:35 Jason Merrill
  0 siblings, 0 replies; only message in thread
From: Jason Merrill @ 2021-05-20 21:35 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:e41d610696b81e72d1d06db176b281424e32fc23

commit r10-9851-ge41d610696b81e72d1d06db176b281424e32fc23
Author: Jason Merrill <jason@redhat.com>
Date:   Wed Apr 7 16:42:44 2021 -0400

    c++: friend with redundant qualification [PR41723]
    
    Different code paths were correctly choosing to look up D directly, since C
    is the current instantiation, but here we decided to try to make it a
    typename type, leading to confusion.  Fixed by using dependent_scope_p as we
    do elsewhere.
    
    gcc/cp/ChangeLog:
    
            PR c++/41723
            * parser.c (cp_parser_class_name): Check dependent_scope_p.
    
    gcc/testsuite/ChangeLog:
    
            PR c++/41723
            * g++.dg/template/friend71.C: New test.

Diff:
---
 gcc/cp/parser.c                          | 2 +-
 gcc/testsuite/g++.dg/template/friend71.C | 8 ++++++++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index d486cf5998f..f48c856fa94 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -23672,7 +23672,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_type_p (scope));
+		&& dependent_scope_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
new file mode 100644
index 00000000000..939ea6b5264
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/friend71.C
@@ -0,0 +1,8 @@
+// PR c++/41723
+
+template<class T>
+class C {
+  template <class U> class D {};
+
+  friend class C::D<int>;
+};


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-05-20 21:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-20 21:35 [gcc r10-9851] c++: friend with redundant qualification [PR41723] Jason Merrill

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).