[Bug c++/86876] friend typedef'ed class in template class can not compile

marxin at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Aug 7 08:09:00 GMT 2018


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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2018-8-7
                 CC|                            |jason at gcc dot gnu.org,
                   |                            |marxin at gcc dot gnu.org,
                   |                            |nathan at gcc dot gnu.org

--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
Note that both clang++ and ICC reject as well:

$ clang++ pr86876.cpp -c
pr86876.cpp:12:22: error: expected a qualified name after 'typename'
  friend typename    X; // g++ fail
                     ^
1 error generated.

$ source>(12): error: a class or namespace qualified name is required

    friend typename    X; // g++ fail

                       ^

<source>(6): error #308: member "B<T>::a [with T=int]" (declared at line 15) is
inaccessible

          void foo(U* p) { printf("p->a = %d\n", p->a); }

                                                    ^

          detected during instantiation of "void A<T>::X<U>::foo(U *) [with
T=int, U=B<int>]" at line 19

compilation aborted for <source> (code 2)

Compiler returned: 2


More information about the Gcc-bugs mailing list