From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nathan Myers To: egcs@cygnus.com Subject: Re: explicit specialization in non-namespace scope Date: Fri, 18 Sep 1998 22:10:00 -0000 Message-id: <3602F287.6074B2ED@nospam.cantrip.org> References: X-SW-Source: 1998-09/msg01090.html Alexandre Oliva wrote: > > Oskar Enoksson writes: > > > The following code compiles with egcs 1.1 but not with egcs-19980914, > > Which is wrong? > > struct X { > > template int Faculty() { return M*Faculty(); } > > template<> int Faculty<0>() { return 1; } > > }; > > egcs 1.1. According to the Standard, template specializations can > only be declared in namespace scope. I believe this is incorrect. I find no such restriction. In addition, in 14.7.3 - Explicit specialization [temp.expl.spec] we have: -17- A member or a member template may be nested within many enclosing class templates. If the declaration of an explicit specialization for such a member appears in namespace scope, the member declaration shall be preceded by a template<> for each enclosing class template that is explicitly specialized. It would not be necessary to say "if" above if that were the only place it could appear. Nathan Myers ncm@cantrip.org