public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/30917] New: ICE with friend in local class (to a function)
@ 2007-02-21 18:24 pinskia at gcc dot gnu dot org
2007-02-21 18:24 ` [Bug c++/30917] " pinskia at gcc dot gnu dot org
` (9 more replies)
0 siblings, 10 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-02-21 18:24 UTC (permalink / raw)
To: gcc-bugs
Testcase:
unsigned count() {
class QGListIterator {
friend class QGList;
QGListIterator( const QGList & );
};
}
--------
I think this is valid code.
--
Summary: ICE with friend in local class (to a function)
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Keywords: ice-on-valid-code
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: pinskia at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30917
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/30917] ICE with friend in local class (to a function)
2007-02-21 18:24 [Bug c++/30917] New: ICE with friend in local class (to a function) pinskia at gcc dot gnu dot org
@ 2007-02-21 18:24 ` pinskia at gcc dot gnu dot org
2007-02-22 6:53 ` [Bug c++/30917] [4.3 Regression] " pinskia at gcc dot gnu dot org
` (8 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-02-21 18:24 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from pinskia at gcc dot gnu dot org 2007-02-21 18:24 -------
The ICE:
t2.cc: In function 'unsigned int count()':
t2.cc:4: internal compiler error: in lookup_name_real, at cp/name-lookup.c:4014
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30917
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/30917] [4.3 Regression] ICE with friend in local class (to a function)
2007-02-21 18:24 [Bug c++/30917] New: ICE with friend in local class (to a function) pinskia at gcc dot gnu dot org
2007-02-21 18:24 ` [Bug c++/30917] " pinskia at gcc dot gnu dot org
@ 2007-02-22 6:53 ` pinskia at gcc dot gnu dot org
2007-02-22 9:36 ` [Bug c++/30917] [4.1/4.2/4.3 " rguenth at gcc dot gnu dot org
` (7 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-02-22 6:53 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from pinskia at gcc dot gnu dot org 2007-02-22 06:52 -------
I take back this being valid code, to make it valid add "class QGList;" before
the function. You still end up with an ICE so this is still a bug.
This worked with "4.1.0 20051026" so it is at least a 4.3.0 regression.
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|ICE with friend in local |[4.3 Regression] ICE with
|class (to a function) |friend in local class (to a
| |function)
Target Milestone|--- |4.3.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30917
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/30917] [4.1/4.2/4.3 Regression] ICE with friend in local class (to a function)
2007-02-21 18:24 [Bug c++/30917] New: ICE with friend in local class (to a function) pinskia at gcc dot gnu dot org
2007-02-21 18:24 ` [Bug c++/30917] " pinskia at gcc dot gnu dot org
2007-02-22 6:53 ` [Bug c++/30917] [4.3 Regression] " pinskia at gcc dot gnu dot org
@ 2007-02-22 9:36 ` rguenth at gcc dot gnu dot org
2007-03-05 4:01 ` mmitchel at gcc dot gnu dot org
` (6 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2007-02-22 9:36 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from rguenth at gcc dot gnu dot org 2007-02-22 09:35 -------
This is a regression on the 4.1 branch. For reference, the valid testcase is
class QGList;
unsigned count()
{
class QGListIterator {
friend class QGList;
QGListIterator( const QGList & );
};
}
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |rguenth at gcc dot gnu dot
| |org
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Known to fail| |4.1.2 4.3.0
Known to work| |4.1.1 4.0.4
Last reconfirmed|0000-00-00 00:00:00 |2007-02-22 09:35:53
date| |
Summary|[4.3 Regression] ICE with |[4.1/4.2/4.3 Regression] ICE
|friend in local class (to a |with friend in local class
|function) |(to a function)
Target Milestone|4.3.0 |4.1.3
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30917
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/30917] [4.1/4.2/4.3 Regression] ICE with friend in local class (to a function)
2007-02-21 18:24 [Bug c++/30917] New: ICE with friend in local class (to a function) pinskia at gcc dot gnu dot org
` (2 preceding siblings ...)
2007-02-22 9:36 ` [Bug c++/30917] [4.1/4.2/4.3 " rguenth at gcc dot gnu dot org
@ 2007-03-05 4:01 ` mmitchel at gcc dot gnu dot org
2007-03-08 6:55 ` patchapp at dberlin dot org
` (5 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2007-03-05 4:01 UTC (permalink / raw)
To: gcc-bugs
--
mmitchel at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P1
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30917
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/30917] [4.1/4.2/4.3 Regression] ICE with friend in local class (to a function)
2007-02-21 18:24 [Bug c++/30917] New: ICE with friend in local class (to a function) pinskia at gcc dot gnu dot org
` (3 preceding siblings ...)
2007-03-05 4:01 ` mmitchel at gcc dot gnu dot org
@ 2007-03-08 6:55 ` patchapp at dberlin dot org
2007-07-08 22:41 ` mmitchel at gcc dot gnu dot org
` (4 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: patchapp at dberlin dot org @ 2007-03-08 6:55 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from patchapp at dberlin dot org 2007-03-08 06:55 -------
Subject: Bug number PR c++/30917
A patch for this bug has been added to the patch tracker.
The mailing list url for the patch is
http://gcc.gnu.org/ml/gcc-patches/2007-03/msg00463.html
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30917
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/30917] [4.1/4.2/4.3 Regression] ICE with friend in local class (to a function)
2007-02-21 18:24 [Bug c++/30917] New: ICE with friend in local class (to a function) pinskia at gcc dot gnu dot org
` (4 preceding siblings ...)
2007-03-08 6:55 ` patchapp at dberlin dot org
@ 2007-07-08 22:41 ` mmitchel at gcc dot gnu dot org
2007-07-28 10:48 ` simartin at gcc dot gnu dot org
` (3 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2007-07-08 22:41 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from mmitchel at gcc dot gnu dot org 2007-07-08 22:40 -------
Simon --
It took me a while to decide that this patch was OK -- but it is. :-) I will
suggest a few changes to make it more obviously correct.
First, minor coding style nit: drop the else after the return that you've
introduced.
Second, we need some chapter-and-verse in here. Please avoid references like
"11.4.8" as the numbers tend to move around as the standard changes. (For
example, I don't think 11.4.8 is the right reference in either the published
standard or the current WP.)
For the comment on the gcc_asert, I would say:
/* A non namespace-scope binding can only be hidden if we
are in a local class, due to friend declarations. In particular,
consider:
void f() {
struct A {
friend struct B;
void g() { B* b; } // error: B is hidden
}
struct B {};
}
The standard says that "B" is a local class in "f" (but not nested within
"A") -- but that name lookup for "B" does not find this declaration until
it is declared directly with "f".
In particular:
[class.friend]
If a friend declaration appears in a local class and the name specified
is an unqualified name, a prior declaration is looked up without considering
scopes that are outside the innermost enclosing non-class scope....
For a friend class declaration, if there is no prior declaration, the class
that is specified belongs to the innermost enclosing non-class scope, but
if it is subsequently referenced, its name is not found by name lookup until
a matching declaration is provided in the innermost enclosing nonclass
scope.
*/
OK with that change.
Thanks,
-- Mark
--
mmitchel at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |simartin at users dot
| |sourceforge dot net
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30917
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/30917] [4.1/4.2/4.3 Regression] ICE with friend in local class (to a function)
2007-02-21 18:24 [Bug c++/30917] New: ICE with friend in local class (to a function) pinskia at gcc dot gnu dot org
` (5 preceding siblings ...)
2007-07-08 22:41 ` mmitchel at gcc dot gnu dot org
@ 2007-07-28 10:48 ` simartin at gcc dot gnu dot org
2007-07-28 20:13 ` simartin at gcc dot gnu dot org
` (2 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: simartin at gcc dot gnu dot org @ 2007-07-28 10:48 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from simartin at gcc dot gnu dot org 2007-07-28 10:48 -------
Subject: Bug 30917
Author: simartin
Date: Sat Jul 28 10:48:30 2007
New Revision: 127016
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=127016
Log:
gcc/cp/
2007-07-28 Simon Martin <simartin@users.sourceforge.net>
Mark Mitchell <mark@codesourcery.com>
PR c++/30917
* name-lookup.c (lookup_name_real): Non namespace-scope bindings can be
hidden due to friend declarations in local classes.
gcc/testsuite/
2007-07-28 Simon Martin <simartin@users.sourceforge.net>
PR c++/30917
* g++.dg/lookup/friend11.C: New test.
Added:
trunk/gcc/testsuite/g++.dg/lookup/friend11.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/name-lookup.c
trunk/gcc/testsuite/ChangeLog
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30917
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/30917] [4.1/4.2/4.3 Regression] ICE with friend in local class (to a function)
2007-02-21 18:24 [Bug c++/30917] New: ICE with friend in local class (to a function) pinskia at gcc dot gnu dot org
` (6 preceding siblings ...)
2007-07-28 10:48 ` simartin at gcc dot gnu dot org
@ 2007-07-28 20:13 ` simartin at gcc dot gnu dot org
2007-07-28 20:14 ` [Bug c++/30917] [4.1 " simartin at gcc dot gnu dot org
2007-08-30 16:33 ` jason at gcc dot gnu dot org
9 siblings, 0 replies; 11+ messages in thread
From: simartin at gcc dot gnu dot org @ 2007-07-28 20:13 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from simartin at gcc dot gnu dot org 2007-07-28 20:12 -------
Subject: Bug 30917
Author: simartin
Date: Sat Jul 28 20:12:42 2007
New Revision: 127023
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=127023
Log:
gcc/cp/
2007-07-28 Simon Martin <simartin@users.sourceforge.net>
Mark Mitchell <mark@codesourcery.com>
PR c++/30917
* name-lookup.c (lookup_name_real): Non namespace-scope bindings can be
hidden due to friend declarations in local classes.
gcc/testsuite/
2007-07-28 Simon Martin <simartin@users.sourceforge.net>
PR c++/30917
* g++.dg/lookup/friend11.C: New test.
Added:
branches/gcc-4_2-branch/gcc/testsuite/g++.dg/lookup/friend11.C
Modified:
branches/gcc-4_2-branch/gcc/cp/ChangeLog
branches/gcc-4_2-branch/gcc/cp/name-lookup.c
branches/gcc-4_2-branch/gcc/testsuite/ChangeLog
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30917
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/30917] [4.1 Regression] ICE with friend in local class (to a function)
2007-02-21 18:24 [Bug c++/30917] New: ICE with friend in local class (to a function) pinskia at gcc dot gnu dot org
` (7 preceding siblings ...)
2007-07-28 20:13 ` simartin at gcc dot gnu dot org
@ 2007-07-28 20:14 ` simartin at gcc dot gnu dot org
2007-08-30 16:33 ` jason at gcc dot gnu dot org
9 siblings, 0 replies; 11+ messages in thread
From: simartin at gcc dot gnu dot org @ 2007-07-28 20:14 UTC (permalink / raw)
To: gcc-bugs
------- Comment #8 from simartin at gcc dot gnu dot org 2007-07-28 20:14 -------
Fixed in 4.2 and 4.3.
--
simartin at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|[4.1/4.2/4.3 Regression] ICE|[4.1 Regression] ICE with
|with friend in local class |friend in local class (to a
|(to a function) |function)
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30917
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/30917] [4.1 Regression] ICE with friend in local class (to a function)
2007-02-21 18:24 [Bug c++/30917] New: ICE with friend in local class (to a function) pinskia at gcc dot gnu dot org
` (8 preceding siblings ...)
2007-07-28 20:14 ` [Bug c++/30917] [4.1 " simartin at gcc dot gnu dot org
@ 2007-08-30 16:33 ` jason at gcc dot gnu dot org
9 siblings, 0 replies; 11+ messages in thread
From: jason at gcc dot gnu dot org @ 2007-08-30 16:33 UTC (permalink / raw)
To: gcc-bugs
------- Comment #9 from jason at gcc dot gnu dot org 2007-08-30 16:33 -------
Fixed by Simon Martin.
--
jason at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Known to fail|4.1.2 4.3.0 |4.1.2
Known to work|4.1.1 4.0.4 |4.1.1 4.0.4 4.3.0
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30917
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2007-08-30 16:33 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-21 18:24 [Bug c++/30917] New: ICE with friend in local class (to a function) pinskia at gcc dot gnu dot org
2007-02-21 18:24 ` [Bug c++/30917] " pinskia at gcc dot gnu dot org
2007-02-22 6:53 ` [Bug c++/30917] [4.3 Regression] " pinskia at gcc dot gnu dot org
2007-02-22 9:36 ` [Bug c++/30917] [4.1/4.2/4.3 " rguenth at gcc dot gnu dot org
2007-03-05 4:01 ` mmitchel at gcc dot gnu dot org
2007-03-08 6:55 ` patchapp at dberlin dot org
2007-07-08 22:41 ` mmitchel at gcc dot gnu dot org
2007-07-28 10:48 ` simartin at gcc dot gnu dot org
2007-07-28 20:13 ` simartin at gcc dot gnu dot org
2007-07-28 20:14 ` [Bug c++/30917] [4.1 " simartin at gcc dot gnu dot org
2007-08-30 16:33 ` jason at gcc dot gnu dot org
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).