public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Nathan Myers <ncm@cygnus.com>
To: egcs@cygnus.com
Subject: Re: explicit specialization in non-namespace scope
Date: Tue, 22 Sep 1998 19:59:00 -0000	[thread overview]
Message-ID: <3608045D.97FEC96A@cygnus.com> (raw)
In-Reply-To: <199809220757.AAA30938.cygnus.egcs@smtp.earthlink.net>

Mark Mitchell wrote:
> 
> >>>>> "Nathan" == Nathan Myers <ncm@cygnus.com> writes: 
>     Nathan> It's still not clear that the above text applies to the
>     Nathan> case mentioned.  "In the namespace of which the enclosing
>     Nathan> class is a member" is satisified both outside and inside
>     Nathan> the class.  When it means to say "not in a class or in a
>     Nathan> block", it says "at namespace scope" or sometimes "in
>     Nathan> namespace scope"; these are changed from "at global scope"
>     Nathan> which is what it said before we had namespaces.  "In the
>     Nathan> namespace of" does not imply "only at namespace scope".
> 
> I can see the sense in your interpretation.  (After all, besides
> implementing the removal of this feature, I also implemented the
> feature in the first place...)

Yes, thank you, thank you!

> But, do you think this is legal:
> 
>   template <class T>
>   struct S {
>     template <class U>     void f(U);
>     template <>            void f(int);
>   };
> 
> even though:
> 
>  template <class T>
>  struct S {
>    template <class U>     void f(U);
>  };
> 
>  template <class T>
>  template <>
>  void S<T>::f(int);
> 
> is not?  The standard says:
> 
>   In an explicit specialization declaration for a member of a class tem-
>   plate or a member template that appears in namespace scope, the member
>   template and some of its enclosing class templates may  remain  unspe-
>   cialized,  except that the declaration shall not explicitly specialize
>   a class member template if  its  enclosing  class  templates  are  not
>   explicitly  specialized as well.
> 
> which doesn't say anything about specializations that are *not* in
> namespace scope, which would therefore lead one to think this rule
> does not apply.  So specializations of member templates in template
> classes are in fact required to be inline?  Seems odd to me, although
> I agree that the paragraph I quote adds credence to your point of view
> about the legality of in-class specializations.  Perhaps I had better
> get that code out of CVS, and reenable it.

Permitting only inline definitions of such specializations would 
indeed be perverse.  Incidentally, the paragraph (18) only addresses 
"declarations", not definitions, but the examples are of definitions.

I think it is clear that in nested specializations, only the inner
ones are allowed to be left unbound.  I don't think it was intended
to be a syntactic restriction, but a semantic one. 

>     >> I can also report that Digital cxx rejects explicit member
>     >> template specializations.
> 
>     Nathan> Digital is a poor choice of compilers to check
>     Nathan> conformance.
> 
> But EDG is a good choice, and it too complains on specializations in
> class scope.

Yes, I have written to them about this.

Nathan Myers
ncm@cantrip.org

  parent reply	other threads:[~1998-09-22 19:59 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [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 [this message]
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
1998-09-21  7:32 Oskar Enoksson
  -- strict thread matches above, loose matches on Subject: below --
1998-09-17  9:59 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3608045D.97FEC96A@cygnus.com \
    --to=ncm@cygnus.com \
    --cc=egcs@cygnus.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).