public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* explicit specialization in non-namespace scope
@ 1998-09-17  9:59 Oskar Enoksson
  1998-09-17 11:14 ` Alexandre Oliva
       [not found] ` <orvhmmk52m.fsf.cygnus.egcs@tiete.dcc.unicamp.br>
  0 siblings, 2 replies; 13+ messages in thread
From: Oskar Enoksson @ 1998-09-17  9:59 UTC (permalink / raw)
  To: egcs

The following code compiles with egcs 1.1 but not with egcs-19980914,
Which is wrong?

class X {
public:
  template<int M>
  int Factulty() { return M*Faculty<M-1>(); }
  template<>
  int Faculty<0>() { return 1; }
};

Thanks!

*/              Oskar Enoksson, Linkoping, Sweden                  /*


^ permalink raw reply	[flat|nested] 13+ messages in thread
* Re: explicit specialization in non-namespace scope
@ 1998-09-21  7:32 Oskar Enoksson
  0 siblings, 0 replies; 13+ messages in thread
From: Oskar Enoksson @ 1998-09-21  7:32 UTC (permalink / raw)
  To: egcs

>>>>> "Nathan" == Nathan Myers <ncm@nospam.cantrip.org> writes:

>> 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.
>
>Since I implemented this, I'd better defend myself. :-)
>
>    [temp.expl.spec] 
>     
>     An explicit specialization shall be declared in the namespace of
>     which the template is a member, or, for member templates, in the
>     namespace of which the enclosing class or enclosing class
>     template is a member.  An explicit specialization of a member
>     function, member class or static data member of a class template
>     shall be declared in the namespace of which the class template
>     is a member.  */

Thanks for all answers!

I can also report that Digital cxx rejects explicit member template
specializations.

To bad, it was very useful ...

/Oskar


^ permalink raw reply	[flat|nested] 13+ messages in thread
[parent not found: <Pine.GSO.3.96.980921144445.7109I-100000.cygnus.egcs@lystra.lysator.liu.se>]

end of thread, other threads:[~1998-09-29 14:32 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-09-17  9:59 explicit specialization in non-namespace scope Oskar Enoksson
1998-09-17 11:14 ` Alexandre Oliva
     [not found] ` <orvhmmk52m.fsf.cygnus.egcs@tiete.dcc.unicamp.br>
1998-09-18 22:10   ` Nathan Myers
1998-09-19 12:03     ` Mark Mitchell
1998-09-21  7:32 Oskar Enoksson
     [not found] <Pine.GSO.3.96.980921144445.7109I-100000.cygnus.egcs@lystra.lysator.liu.se>
1998-09-21 19:37 ` Nathan Myers
1998-09-22  6:35   ` Alexandre Oliva
1998-09-22  9:00   ` Mark Mitchell
     [not found]   ` <199809220757.AAA30938.cygnus.egcs@smtp.earthlink.net>
1998-09-22 19:59     ` Nathan Myers
1998-09-23  8:43       ` Matthias Mueller
1998-09-28 16:32       ` Mark Mitchell
     [not found]       ` <199809282301.QAA19439.cygnus.egcs@smtp.earthlink.net>
1998-09-29 14:32         ` Nathan Myers
     [not found] ` <org1dk8m82.fsf.cygnus.egcs@araguaia.dcc.unicamp.br>
1998-09-22 19:41   ` Nathan Myers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).