This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Namespace and Specialization Trouble moving 2.95.2 code to 3.0.


On Aug 10, 2001, Benjamin Scherrey <scherrey@innoverse.com> wrote:

> It complains that I'm "specializing 'struct std::less<Armour::VHandle<T> >' 
> in different namespace from definition of 'template<class _Tp> struct 
> std::less'.

This seems to be based on [temp.expl.spec]/2, but this only requires
the declaration of an explicit specialization to be in the same
namespace as the template.  Besides, you example is a partial
specialization, not an explicit specialization.  [temp.class.spec]/6,
OTOH, says the declaration of a partial specialization of a template
class may appear anywhere its definition might appear.  But then,
[namespace.memdef]/2 says a member of a namespace can be defined
outside the namespace using explicit qualification, as long as the
entity was previously declared inside the namespace.  It's not clear
to me whether this rules out declarations and definitions of partial
specializations outside the namespace containing the original
template, especially given that [temp.class.spec]/7 says partial
specializations are not found by name lookup.  However, it does
mention their declarations as relevant, and its Example re-enters the
namespace to declare and define a template partial specialization,
which seems to indicate this is important to do.

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist    *Please* write to mailing lists, not to me


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]