public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c++/8056: Friends and partial specializations
@ 2002-09-26 11:56 bangerth
0 siblings, 0 replies; only message in thread
From: bangerth @ 2002-09-26 11:56 UTC (permalink / raw)
To: gcc-gnats
>Number: 8056
>Category: c++
>Synopsis: Friends and partial specializations
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Sep 26 11:56:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator: Wolfgang Bangerth
>Release: unknown-1.0
>Organization:
>Environment:
gcc 3.2
>Description:
The following small progra shows two problems with friend
declarations and partial specializations:
----------------------------------------
template <int N, typename T> class X;
template <typename T> class X<1,T>;
namespace NS {
class Y {
static int i;
template <int N, typename T> friend class X;
template <typename T> friend class X<1,T>;
};
};
template <typename T> class X<1,T> {
X () { NS::Y::i; }; // access private field
};
template class X<1,int>;-------------------------------------
The first is that gcc3.2 rejects the second friend
declaration. I think it was discussed some time ago that
the present grammar does not allow this anyway, so this
would not be a bug in gcc. icc rejects it as well.
The second problem is that once you remove the offending
line, the partial specialization is no longer a friend, so
should not be able to access the private member. Yet, gcc
compiles this snippet, while icc does not. I guess this
counts as a bug, as annoying it may be since then we are
no longer able to allow partial specializations access to
private members...
Regards
Wolfgang
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2002-09-26 18:56 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-09-26 11:56 c++/8056: Friends and partial specializations bangerth
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).