public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/21092] New: friend inaccessibility
@ 2005-04-18 19:38 Ralf dot Wildenhues at gmx dot de
2005-04-18 19:40 ` [Bug c++/21092] " pinskia at gcc dot gnu dot org
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: Ralf dot Wildenhues at gmx dot de @ 2005-04-18 19:38 UTC (permalink / raw)
To: gcc-bugs
A recent change on CVS HEAD breaks this:
$ cat a.cc
class X {
friend class Y;
friend int foo(const Y&);
};
$ g++ -c -W -Wall a.cc
a.cc:3: error: expected ',' or '...' before '&' token
a.cc:3: error: ISO C++ forbids declaration of 'Y' with no type
The original bug report is against CLN with possibly more info
of value, and may be read here:
http://thep.physik.uni-mainz.de/pipermail/cln-list/2005-April/000119.html
AFAIK gcc-4.0.0 is fine.
--
Summary: friend inaccessibility
Product: gcc
Version: 4.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: Ralf dot Wildenhues at gmx dot de
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21092
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/21092] friend inaccessibility
2005-04-18 19:38 [Bug c++/21092] New: friend inaccessibility Ralf dot Wildenhues at gmx dot de
@ 2005-04-18 19:40 ` pinskia at gcc dot gnu dot org
2005-04-18 20:19 ` kreckel at ginac dot de
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-04-18 19:40 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-04-18 19:40 -------
No, the code is invalid, as Y has not been interjected yet. This is a progression and not a regression.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21092
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/21092] friend inaccessibility
2005-04-18 19:38 [Bug c++/21092] New: friend inaccessibility Ralf dot Wildenhues at gmx dot de
2005-04-18 19:40 ` [Bug c++/21092] " pinskia at gcc dot gnu dot org
@ 2005-04-18 20:19 ` kreckel at ginac dot de
2005-04-18 20:29 ` bangerth at dealii dot org
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: kreckel at ginac dot de @ 2005-04-18 20:19 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From kreckel at ginac dot de 2005-04-18 20:19 -------
(In reply to comment #1)
> No, the code is invalid, as Y has not been interjected yet. This is a
progression and not a regression.
Really? What about paragraph 11.4/7 "A name nominated by a friend
declaration shall be accessible in the scope of the class containing the
friend declaration."
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21092
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/21092] friend inaccessibility
2005-04-18 19:38 [Bug c++/21092] New: friend inaccessibility Ralf dot Wildenhues at gmx dot de
2005-04-18 19:40 ` [Bug c++/21092] " pinskia at gcc dot gnu dot org
2005-04-18 20:19 ` kreckel at ginac dot de
@ 2005-04-18 20:29 ` bangerth at dealii dot org
2005-04-18 20:34 ` bangerth at dealii dot org
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: bangerth at dealii dot org @ 2005-04-18 20:29 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From bangerth at dealii dot org 2005-04-18 20:29 -------
This sentence just says that you can't do this:
class A { private: struct I{}; };
class B { friend class A::I; };
because A::I isn't accessible in B.
W.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21092
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/21092] friend inaccessibility
2005-04-18 19:38 [Bug c++/21092] New: friend inaccessibility Ralf dot Wildenhues at gmx dot de
` (2 preceding siblings ...)
2005-04-18 20:29 ` bangerth at dealii dot org
@ 2005-04-18 20:34 ` bangerth at dealii dot org
2005-04-18 21:04 ` kreckel at ginac dot de
2005-04-18 21:08 ` kreckel at ginac dot de
5 siblings, 0 replies; 7+ messages in thread
From: bangerth at dealii dot org @ 2005-04-18 20:34 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From bangerth at dealii dot org 2005-04-18 20:34 -------
And the answer to the original question: even though gcc handled it as this
in the past (incorrectly), a friend declaration is not a declaration. In
other words, if a name is not declared before, but first seen in a friend
declaration, then this does not make this name known. This is the problem
you run against: class Y is only marked for friendship in the friend
declaration,
for when the class is actually declared later on. However, it is still
undeclared once you get to the function declaration.
W.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21092
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/21092] friend inaccessibility
2005-04-18 19:38 [Bug c++/21092] New: friend inaccessibility Ralf dot Wildenhues at gmx dot de
` (3 preceding siblings ...)
2005-04-18 20:34 ` bangerth at dealii dot org
@ 2005-04-18 21:04 ` kreckel at ginac dot de
2005-04-18 21:08 ` kreckel at ginac dot de
5 siblings, 0 replies; 7+ messages in thread
From: kreckel at ginac dot de @ 2005-04-18 21:04 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From kreckel at ginac dot de 2005-04-18 21:04 -------
(In reply to comment #3)
> This sentence just says that you can't do this:
> class A { private: struct I{}; };
> class B { friend class A::I; };
> because A::I isn't accessible in B.
Where's that snippet from? As it stands, it's out of any context whatsoever.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21092
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/21092] friend inaccessibility
2005-04-18 19:38 [Bug c++/21092] New: friend inaccessibility Ralf dot Wildenhues at gmx dot de
` (4 preceding siblings ...)
2005-04-18 21:04 ` kreckel at ginac dot de
@ 2005-04-18 21:08 ` kreckel at ginac dot de
5 siblings, 0 replies; 7+ messages in thread
From: kreckel at ginac dot de @ 2005-04-18 21:08 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From kreckel at ginac dot de 2005-04-18 21:08 -------
(In reply to comment #5)
> (In reply to comment #3)
> > This sentence just says that you can't do this:
> > class A { private: struct I{}; };
> > class B { friend class A::I; };
> > because A::I isn't accessible in B.
>
> Where's that snippet from? As it stands, it's out of any context whatsoever.
Oh, sorry. Now I understand what you're referring to.
11.4/9 appears to be the relevant section in this case.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21092
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2005-04-18 21:08 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-04-18 19:38 [Bug c++/21092] New: friend inaccessibility Ralf dot Wildenhues at gmx dot de
2005-04-18 19:40 ` [Bug c++/21092] " pinskia at gcc dot gnu dot org
2005-04-18 20:19 ` kreckel at ginac dot de
2005-04-18 20:29 ` bangerth at dealii dot org
2005-04-18 20:34 ` bangerth at dealii dot org
2005-04-18 21:04 ` kreckel at ginac dot de
2005-04-18 21:08 ` kreckel at ginac dot de
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).