https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100918

--- Comment #9 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #8)
> (In reply to Christian Prochaska from comment #7)
> > Since the commit above the following test fails. Is this correct?
> 
> > 
> > class T1 { };
> > class T2 { };
> > 
> > template <typename T>
> > class A { };
> > 
> > class B : A<T1> { };
> > 
> > class C : B
> > {
> >     class D : A<T2> { };
> > };
> > 
> > test.cc:11:19: error: ‘class A<T1> A<T1>::A’ is private within this context
> >    11 |         class D : A<T2> { };
> >       |                   ^~~~~
> > test.cc:7:7: note: declared private here
> >     7 | class B : A<T1> { };
> >       |       ^
> 
> 
> 
> Yes it should be rejected as A is a private name of A<T1> and A<T1> is
> private to B. clang rejects it for the same reason though has a better error
> message:
> <source>:12:19: error: 'A' is a private member of 'A<T1>'
>         class D : A<T2> { };
>                   ^
> <source>:8:11: note: constrained by implicitly private inheritance here
> class B : A<T1> { };
>           ^~~~~
> <source>:6:7: note: member is declared here
> class A { };
>       ^

An obvious fix is to use ::A<T2> while inside C .

Reply via email to