public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c++/5094: partial specialisation cannot be friend??
@ 2001-12-12 20:16 Martin Sebor
0 siblings, 0 replies; 6+ messages in thread
From: Martin Sebor @ 2001-12-12 20:16 UTC (permalink / raw)
To: nobody; +Cc: gcc-prs
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1197 bytes --]
The following reply was made to PR c++/5094; it has been noted by GNATS.
From: Martin Sebor <sebor@roguewave.com>
To: gcc-gnats@gcc.gnu.org
Cc:
Subject: Re: c++/5094: partial specialisation cannot be friend??
Date: Wed, 12 Dec 2001 21:23:58 -0700
rodrigc@gcc.gnu.org wrote:
>
> Synopsis: partial specialisation cannot be friend??
>
> State-Changed-From-To: open->analyzed
> State-Changed-By: rodrigc
> State-Changed-When: Wed Dec 12 19:58:51 2001
> State-Changed-Why:
> 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:
Although I also have respect for the latest version of Compaq C++,
it should be noted that the compiler isn't "the ultimate authority"
on the validity of C++ code. What clenches it is that 14.5.3, p9
explicitly prohibits friend declarations of partial specializations:
-9- Friend declarations shall not declare partial specializations.
[Example:
template<class T> class A { };
class X {
template<class T> friend class A<T*>; // error
};
end example]
Regards
Martin
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: c++/5094: partial specialisation cannot be friend??
@ 2002-12-19 7:36 lerdsuwa
0 siblings, 0 replies; 6+ messages in thread
From: lerdsuwa @ 2002-12-19 7:36 UTC (permalink / raw)
To: benko, gcc-bugs, gcc-prs, lerdsuwa
Synopsis: partial specialisation cannot be friend??
State-Changed-From-To: analyzed->closed
State-Changed-By: lerdsuwa
State-Changed-When: Thu Dec 19 07:36:45 2002
State-Changed-Why:
Fixed in 3.3 and main trunk. Now only the template friend
template <typename T> friend class d<c<T> >;
is rejected. The rest is accepted.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=5094
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: c++/5094: partial specialisation cannot be friend??
@ 2001-12-14 0:16 Pal Benko
0 siblings, 0 replies; 6+ messages in thread
From: Pal Benko @ 2001-12-14 0:16 UTC (permalink / raw)
To: nobody; +Cc: gcc-prs
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=
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: c++/5094: partial specialisation cannot be friend??
@ 2001-12-12 20:06 rodrigc
0 siblings, 0 replies; 6+ messages in thread
From: rodrigc @ 2001-12-12 20:06 UTC (permalink / raw)
To: nobody; +Cc: gcc-prs
The following reply was made to PR c++/5094; it has been noted by GNATS.
From: rodrigc@gcc.gnu.org
To: benko@sztaki.hu, gcc-bugs@gcc.gnu.org, gcc-gnats@gcc.gnu.org,
gcc-prs@gcc.gnu.org, nobody@gcc.gnu.org
Cc:
Subject: Re: c++/5094: partial specialisation cannot be friend??
Date: 13 Dec 2001 03:58:51 -0000
Synopsis: partial specialisation cannot be friend??
State-Changed-From-To: open->analyzed
State-Changed-By: rodrigc
State-Changed-When: Wed Dec 12 19:58:51 2001
State-Changed-Why:
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;
-----------------^
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> >;
---------------^
cxx: Error: specfriend.cc, line 83: class "c" may not have a template
argument list
friend class c<d>;
---------------^
cxx: Info: 5 errors detected in the compilation of "specfriend.cc".
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&pr=5094&database=gcc
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: c++/5094: partial specialisation cannot be friend??
@ 2001-12-12 19:58 rodrigc
0 siblings, 0 replies; 6+ messages in thread
From: rodrigc @ 2001-12-12 19:58 UTC (permalink / raw)
To: benko, gcc-bugs, gcc-gnats, gcc-prs, nobody
Synopsis: partial specialisation cannot be friend??
State-Changed-From-To: open->analyzed
State-Changed-By: rodrigc
State-Changed-When: Wed Dec 12 19:58:51 2001
State-Changed-Why:
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;
-----------------^
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> >;
---------------^
cxx: Error: specfriend.cc, line 83: class "c" may not have a template
argument list
friend class c<d>;
---------------^
cxx: Info: 5 errors detected in the compilation of "specfriend.cc".
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&pr=5094&database=gcc
^ permalink raw reply [flat|nested] 6+ messages in thread
* c++/5094: partial specialisation cannot be friend??
@ 2001-12-12 7:26 benko
0 siblings, 0 replies; 6+ messages in thread
From: benko @ 2001-12-12 7:26 UTC (permalink / raw)
To: gcc-gnats
>Number: 5094
>Category: c++
>Synopsis: partial specialisation cannot be friend??
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed Dec 12 07:26:01 PST 2001
>Closed-Date:
>Last-Modified:
>Originator: Benko Pal
>Release: 3.0.2
>Organization:
>Environment:
SuSE 7.1, i686
>Description:
The attached file tries several configuration of friend declaration.
Some of them fails; I think these should behave identically to those
not failing.
arta:~/c/proba$ /gml/shared/gcc-3.0.2/bin/g++ -c specfriend.cc
specfriend.cc:42: partial specialization `c<d<T> >' declared `friend'
specfriend.cc:55: partial specialization `d<c<T> >' declared `friend'
specfriend.cc:59: expected 1 levels of template parms for `class b::inner<I>',
got 2
specfriend.cc:71: partial specialization `d<c<T> >' declared `friend'
zsh: exit 1 /gml/shared/gcc-3.0.2/bin/g++ -c specfriend.cc
arta:~/c/proba$
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="specfriend.cc"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="specfriend.cc"
c3RydWN0IGEKewogIGNsYXNzIGlubmVyCiAgewogICAgZnJpZW5kIGNsYXNzIGE7CiAgfTsKfTsK
CnN0cnVjdCBiCnsKICB0ZW1wbGF0ZSA8aW50IEk+CiAgY2xhc3MgaW5uZXIKICB7CiAgICBmcmll
bmQgY2xhc3MgYjsKICB9Owp9OwoKdGVtcGxhdGUgPHR5cGVuYW1lIFQ+CnN0cnVjdCBjCnsKICBj
bGFzcyBpbm5lcgogIHsKICAgIGZyaWVuZCBjbGFzcyBjOwogIH07Cn07Cgp0ZW1wbGF0ZSA8dHlw
ZW5hbWUgVD4Kc3RydWN0IGQKewogIHRlbXBsYXRlIDxpbnQgST4KICBjbGFzcyBpbm5lcgogIHsK
ICAgIGZyaWVuZCBjbGFzcyBkOwogIH07Cn07Cgp0ZW1wbGF0ZSA8dHlwZW5hbWUgVD4Kc3RydWN0
IGM8ZDxUPiA+CnsKICBjbGFzcyBpbm5lcgogIHsKICAgIGZyaWVuZCBjbGFzcyBjOwogIH07Cgog
IHRlbXBsYXRlIDx0eXBlbmFtZSBVPgogIGZyaWVuZCBjbGFzcyBjOwp9OwoKdGVtcGxhdGUgPHR5
cGVuYW1lIFQ+CnN0cnVjdCBkPGM8VD4gPgp7CiAgdGVtcGxhdGUgPGludCBJPgogIGNsYXNzIGlu
bmVyCiAgewogICAgZnJpZW5kIGNsYXNzIGQ7CiAgfTsKCiAgdGVtcGxhdGUgPGludCBJPgogIGZy
aWVuZCBjbGFzcyBiOjppbm5lcjsKfTsKCnRlbXBsYXRlIDw+CnN0cnVjdCBjPGludD4KewogIGNs
YXNzIGlubmVyCiAgewogICAgZnJpZW5kIGNsYXNzIGM7CiAgfTsKCiAgdGVtcGxhdGUgPHR5cGVu
YW1lIFQ+CiAgZnJpZW5kIGNsYXNzIGQ8YzxUPiA+Owp9OwoKdGVtcGxhdGUgPD4Kc3RydWN0IGQ8
aW50Pgp7CiAgdGVtcGxhdGUgPGludCBJPgogIGNsYXNzIGlubmVyCiAgewogICAgZnJpZW5kIGNs
YXNzIGQ7CiAgfTsKCiAgZnJpZW5kIGNsYXNzIGM8ZD47Cn07Cg==
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2002-12-19 15:36 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-12-12 20:16 c++/5094: partial specialisation cannot be friend?? Martin Sebor
-- strict thread matches above, loose matches on Subject: below --
2002-12-19 7:36 lerdsuwa
2001-12-14 0:16 Pal Benko
2001-12-12 20:06 rodrigc
2001-12-12 19:58 rodrigc
2001-12-12 7:26 benko
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).