From: Jason Merrill Date: Thu, 12 May 2022 21:08:52 +0000 (-0400) Subject: Revert "c++: friend with redundant qualification [PR41723]" X-Git-Tag: releases/gcc-10.4.0~141 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c2e39b9e1568484192c3a4c2b4425b06e701a3fe;p=thirdparty%2Fgcc.git Revert "c++: friend with redundant qualification [PR41723]" 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. --- diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 1499bf5d258b..4c36cbeeb489 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -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 index 939ea6b52644..000000000000 --- a/gcc/testsuite/g++.dg/template/friend71.C +++ /dev/null @@ -1,8 +0,0 @@ -// PR c++/41723 - -template -class C { - template class D {}; - - friend class C::D; -}; diff --git a/gcc/testsuite/g++.dg/template/nested7.C b/gcc/testsuite/g++.dg/template/nested7.C new file mode 100644 index 000000000000..3a5930c0f314 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/nested7.C @@ -0,0 +1,12 @@ +// PR c++/102300 + +template +struct holder +{ + template struct fn {}; + + struct t1 : fn {}; // pass + struct t2 : holder::fn {}; // fail + struct t3 : holder::template fn {}; // fail + struct t4 : holder::template fn {}; // pass +};