Templates declared in class scope

Reid M. Pinchback reidmp@mit.edu
Fri Sep 4 21:38:00 GMT 1998


I just spotted something interesting in 19980824.  The following
code fragment:

  namespace foo {
    template <class T> struct A {};
    struct B {
      template <class T> struct A {};
    };
  }

causes egcs to complain:

  redefinition of 'struct ::foo::A<T>'

Now, in [temp] para 5 we have:
  "The name of a class template shall not be declared to refer
   to any other template, ..., in the same scope (3.3)"

but isn't template A in namespace scope while the member 
template B::A is in class scope?
 
 
====================================================
= Reid M. Pinchback                                =
= I/T Delivery, MIT                                =
=                                                  =
= Email:   reidmp@mit.edu                          =
= URL:     http://web.mit.edu/reidmp/www/home.html =
====================================================




More information about the Gcc mailing list