public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: Pal Benko <benko@sztaki.hu>
To: nobody@gcc.gnu.org
Cc: gcc-prs@gcc.gnu.org,
Subject: Re: c++/5094: partial specialisation cannot be friend??
Date: Fri, 14 Dec 2001 00:16:00 -0000	[thread overview]
Message-ID: <20011214081602.21241.qmail@sources.redhat.com> (raw)

The following reply was made to PR c++/5094; it has been noted by GNATS.

From: Pal Benko <benko@sztaki.hu>
To: rodrigc@gcc.gnu.org
Cc: gcc-bugs@gcc.gnu.org, gcc-gnats@gcc.gnu.org, gcc-prs@gcc.gnu.org,
 nobody@gcc.gnu.org
Subject: Re: c++/5094: partial specialisation cannot be friend??
Date: Fri, 14 Dec 2001 09:08:51 +0100

 Thank you for the quick answer.
 
 >     This is not a bug in gcc.  
 >     This is not legal code.  When I compile with
 >     the Digital Unix C++ compiler, I get the
 >     following compilation errors:
 >     
 >     cxx: Error: specfriend.cc, line 67: "c" has already been declared in =
 the
 >               current scope
 >         friend class c;
 >     -----------------^
 
 Is
 
 template <>
 struct c<int>
 {
   class inner
   {
     friend class c<int>;
   };
 
   template <typename T>
   friend class d<c<T> >;
 };
 
 correct?  gcc accepts it, but it also accepted the previous version.
 
 >     cxx: Error: specfriend.cc, line 71: class "c" may not have a template
 >               argument list
 >       friend class d<c<T> >;
 >     -----------------^
 >     cxx: Error: specfriend.cc, line 71: class "c" may not have a template
 >               argument list
 >       friend class d<c<T> >;
 >     -----------------^
 >     cxx: Error: specfriend.cc, line 71: invalid partial specialization --
 >     class
 >               "d<<error-type>>" is already fully specialized
 >       friend class d<c<T> >;
 >     ---------------^
 
 OK, Martin Sebor gave the exact reference from the standard.
 
 >     cxx: Error: specfriend.cc, line 83: class "c" may not have a template
 >               argument list
 >       friend class c<d>;
 >     ---------------^
 
 again: is
 
 template <>
 struct d<int>
 {
   template <int I>
   class inner
   {
     friend class d;
   };
 
   friend class c<d<int> >;
 };
 
 correct?  gcc accepts, as previously.
 
 
 And there are three error messages of gcc not reproduced by the
 Digital Unix C++ in lines 42, 55 and 59 of the original bugreport.  A
 simplified testcase:
 
 struct b
 {
   template <int I>
   class inner
   {};
 };
 
 template <typename T>
 struct c {};
 
 template <typename T>
 struct c<T*>
 {
   class inner
   {
     friend class c;
   };
 };
 
 template <typename T>
 struct c<c<T> >
 {
   template <int I>
   class inner
   {
     friend class c;
   };
 
   template <int I>
   friend class b::inner;
 };
 
 
 Thanks again,
 
 Benko Pal=
 


             reply	other threads:[~2001-12-14  8:16 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-12-14  0:16 Pal Benko [this message]
  -- strict thread matches above, loose matches on Subject: below --
2002-12-19  7:36 lerdsuwa
2001-12-12 20:16 Martin Sebor
2001-12-12 20:06 rodrigc
2001-12-12 19:58 rodrigc
2001-12-12  7:26 benko

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=20011214081602.21241.qmail@sources.redhat.com \
    --to=benko@sztaki.hu \
    --cc=gcc-prs@gcc.gnu.org \
    --cc=nobody@gcc.gnu.org \
    /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).