c++: base template friend [PR52625]
Here we were mistakenly treating the injected-class-name as a partial specialization. gcc/cp/ChangeLog: PR c++/52625 * pt.c (maybe_process_partial_specialization): Check DECL_SELF_REFERENCE_P. gcc/testsuite/ChangeLog: PR c++/52625 * g++.dg/template/friend70.C: New test.
This commit is contained in:
parent
a528594cf9
commit
b40d45cb19
@ -984,6 +984,10 @@ maybe_process_partial_specialization (tree type)
|
||||
if (CLASS_TYPE_P (type) && CLASSTYPE_LAMBDA_EXPR (type))
|
||||
return type;
|
||||
|
||||
/* An injected-class-name is not a specialization. */
|
||||
if (DECL_SELF_REFERENCE_P (TYPE_NAME (type)))
|
||||
return type;
|
||||
|
||||
if (TREE_CODE (type) == BOUND_TEMPLATE_TEMPLATE_PARM)
|
||||
{
|
||||
error ("name of class shadows template template parameter %qD",
|
||||
|
9
gcc/testsuite/g++.dg/template/friend70.C
Normal file
9
gcc/testsuite/g++.dg/template/friend70.C
Normal file
@ -0,0 +1,9 @@
|
||||
// PR c++/52625
|
||||
|
||||
template<class>
|
||||
class base {};
|
||||
|
||||
class derived : public base<derived>
|
||||
{
|
||||
template<class> friend class base;
|
||||
};
|
Loading…
Reference in New Issue
Block a user