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

            Bug ID: 65943
           Summary: template keyword required for base-specifier that
                    names member of the current instantiation
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: redi at gcc dot gnu.org
  Target Milestone: ---

template<class A> struct X
{
    template<class B> struct Base;
    template<class B> struct Data;
};

template<class A>
template<class B>
struct X<A>::Data : X<A>::Base<B>
{ };


This fails to compile:

f.cc:9:33: error: ‘typename X<A>::Base’ names ‘template<class A> template<class
B> struct X<A>::Base’, which is not a type
 struct X<A>::Data : X<A>::Base<B>
                                 ^
f.cc:9:27: error: ‘typename X<A>::Base’ names ‘template<class A> template<class
B> struct X<A>::Base’, which is not a type
 struct X<A>::Data : X<A>::Base<B>
                           ^
f.cc:10:1: error: expected class-name before ‘{’ token
 { };
 ^

Clang and EDG accept it.

It compiles if the base-specifier is changed to X<A>::template Base<B>, but I
think the addition of "but the name is not a member of the current
instantiation" to C++11 14.2 [temp.names] p4 should make it valid.

In any case, http://open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#1710 will
definitely make it valid. See also
http://open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#1812 and
http://open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#314

Reply via email to