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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |RESOLVED
         Resolution|---                         |INVALID

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to rockeet from comment #0)
> // code:
> #include <stdio.h>
> template<class T>
> struct A {
>     template<class U>
>     struct X {
>         void foo(U* p) { printf("p->a = %d\n", p->a); }
>     };
> };
> template<class T>
> struct B {
>     typedef typename A<T>::template X<B<T> > X;
> //  friend typename    X; // g++ fail

It's not helpful to report a compilation failure for code with the problem
commented out. You need to provide the code that produces the error.

Anyway, this is invalid. The C++ grammar says a typename-specifier must be one
of:

  typename nested-name-specifier identifier
  typename nested-name-specifier simple-template-id
  typename nested-name-specifier template simple-template-id

As the compiler says, a nested-name-specifier is expected, and so your code is
invalid.

Reply via email to