* [Bug c++/14513] namespace problem
2004-03-10 15:42 [Bug c++/14513] New: namespace problem bugzilla-gcc at thewrittenword dot com
@ 2004-03-10 15:53 ` pinskia at gcc dot gnu dot org
2004-03-10 16:24 ` [Bug c++/14513] Friend name injection problem (implicit declaration) bangerth at dealii dot org
` (11 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-03-10 15:53 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-03-10 15:53 -------
Confirmed.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
Keywords| |accepts-invalid
Known to fail| |2.95.3 3.1 3.3 3.5.0
Last reconfirmed|0000-00-00 00:00:00 |2004-03-10 15:53:04
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14513
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/14513] Friend name injection problem (implicit declaration)
2004-03-10 15:42 [Bug c++/14513] New: namespace problem bugzilla-gcc at thewrittenword dot com
2004-03-10 15:53 ` [Bug c++/14513] " pinskia at gcc dot gnu dot org
@ 2004-03-10 16:24 ` bangerth at dealii dot org
2004-03-10 19:55 ` gdr at integrable-solutions dot net
` (10 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: bangerth at dealii dot org @ 2004-03-10 16:24 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From bangerth at dealii dot org 2004-03-10 16:24 -------
OK, so here's what happens:
------------
struct S {
void test (void);
};
namespace NS {
class X {
friend class S;
static int *i;
};
}
void S::test () {
NS::X::i;
}
---------------
gcc thinks the 'friend class S' declaration refers to class ::S and thus
allows the access in S::test. All the other compilers seem to believe
that the friend declaration refer to a yet-to-be-declared class NS::S,
and therefore don't allow access in ::S::test. I have yet to understand
what the standard really says in this respect. Kriang?
W.
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |lerdsuwa at gcc dot gnu dot
| |org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14513
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/14513] Friend name injection problem (implicit declaration)
2004-03-10 15:42 [Bug c++/14513] New: namespace problem bugzilla-gcc at thewrittenword dot com
2004-03-10 15:53 ` [Bug c++/14513] " pinskia at gcc dot gnu dot org
2004-03-10 16:24 ` [Bug c++/14513] Friend name injection problem (implicit declaration) bangerth at dealii dot org
@ 2004-03-10 19:55 ` gdr at integrable-solutions dot net
2004-08-12 0:58 ` pinskia at gcc dot gnu dot org
` (9 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: gdr at integrable-solutions dot net @ 2004-03-10 19:55 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From gdr at integrable-solutions dot net 2004-03-10 19:55 -------
Subject: Re: Friend name injection problem (implicit declaration)
"bangerth at dealii dot org" <gcc-bugzilla@gcc.gnu.org> writes:
| OK, so here's what happens:
| ------------
| struct S {
| void test (void);
| };
|
| namespace NS {
| class X {
| friend class S;
| static int *i;
| };
| }
|
| void S::test () {
| NS::X::i;
| }
| ---------------
| gcc thinks the 'friend class S' declaration refers to class ::S and thus
| allows the access in S::test. All the other compilers seem to believe
| that the friend declaration refer to a yet-to-be-declared class NS::S,
| and therefore don't allow access in ::S::test. I have yet to understand
| what the standard really says in this respect. Kriang?
I'm not Kriang but I'm going to answer. Yes, GCC's behaviour is
wrong. Compilers that reject the code are right. See the explanation
I gave in the link pointed to in the original report. If you want
chapter and verse, see somewhere in 7.3.1.x for namespace members that
talk about friend declarations.
-- Gaby
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14513
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/14513] Friend name injection problem (implicit declaration)
2004-03-10 15:42 [Bug c++/14513] New: namespace problem bugzilla-gcc at thewrittenword dot com
` (2 preceding siblings ...)
2004-03-10 19:55 ` gdr at integrable-solutions dot net
@ 2004-08-12 0:58 ` pinskia at gcc dot gnu dot org
2004-09-04 12:47 ` lerdsuwa at gcc dot gnu dot org
` (8 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-08-12 0:58 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
OtherBugsDependingO| |16995
nThis| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14513
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/14513] Friend name injection problem (implicit declaration)
2004-03-10 15:42 [Bug c++/14513] New: namespace problem bugzilla-gcc at thewrittenword dot com
` (3 preceding siblings ...)
2004-08-12 0:58 ` pinskia at gcc dot gnu dot org
@ 2004-09-04 12:47 ` lerdsuwa at gcc dot gnu dot org
2004-10-17 14:08 ` lerdsuwa at gcc dot gnu dot org
` (7 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: lerdsuwa at gcc dot gnu dot org @ 2004-09-04 12:47 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From lerdsuwa at gcc dot gnu dot org 2004-09-04 12:47 -------
Looking at friend class injection bugs.
--
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |lerdsuwa at gcc dot gnu dot
|dot org |org
Status|NEW |ASSIGNED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14513
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/14513] Friend name injection problem (implicit declaration)
2004-03-10 15:42 [Bug c++/14513] New: namespace problem bugzilla-gcc at thewrittenword dot com
` (4 preceding siblings ...)
2004-09-04 12:47 ` lerdsuwa at gcc dot gnu dot org
@ 2004-10-17 14:08 ` lerdsuwa at gcc dot gnu dot org
2004-11-12 17:03 ` lerdsuwa at gcc dot gnu dot org
` (6 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: lerdsuwa at gcc dot gnu dot org @ 2004-10-17 14:08 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From lerdsuwa at gcc dot gnu dot org 2004-10-17 14:08 -------
Patches submitted. Both patches are required to fix this bug.
http://gcc.gnu.org/ml/gcc-patches/2004-10/msg01321.html
http://gcc.gnu.org/ml/gcc-patches/2004-10/msg01372.html
--
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |patch
Known to fail|2.95.3 3.1 3.3 4.0 |2.95.3 3.1 3.3 4.0.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14513
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/14513] Friend name injection problem (implicit declaration)
2004-03-10 15:42 [Bug c++/14513] New: namespace problem bugzilla-gcc at thewrittenword dot com
` (5 preceding siblings ...)
2004-10-17 14:08 ` lerdsuwa at gcc dot gnu dot org
@ 2004-11-12 17:03 ` lerdsuwa at gcc dot gnu dot org
2004-11-19 10:10 ` lerdsuwa at gcc dot gnu dot org
` (5 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: lerdsuwa at gcc dot gnu dot org @ 2004-11-12 17:03 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From lerdsuwa at gcc dot gnu dot org 2004-11-12 17:03 -------
One more patch is required. And libjava problem has to be fixed before this bug
is revisited.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14513
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/14513] Friend name injection problem (implicit declaration)
2004-03-10 15:42 [Bug c++/14513] New: namespace problem bugzilla-gcc at thewrittenword dot com
` (6 preceding siblings ...)
2004-11-12 17:03 ` lerdsuwa at gcc dot gnu dot org
@ 2004-11-19 10:10 ` lerdsuwa at gcc dot gnu dot org
2004-11-25 16:55 ` cvs-commit at gcc dot gnu dot org
` (4 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: lerdsuwa at gcc dot gnu dot org @ 2004-11-19 10:10 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From lerdsuwa at gcc dot gnu dot org 2004-11-19 10:09 -------
Last part is submitted:
http://gcc.gnu.org/ml/gcc-patches/2004-11/msg01495.html
This one together with earlier parts fix the bug.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14513
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/14513] Friend name injection problem (implicit declaration)
2004-03-10 15:42 [Bug c++/14513] New: namespace problem bugzilla-gcc at thewrittenword dot com
` (7 preceding siblings ...)
2004-11-19 10:10 ` lerdsuwa at gcc dot gnu dot org
@ 2004-11-25 16:55 ` cvs-commit at gcc dot gnu dot org
2004-11-25 17:05 ` lerdsuwa at gcc dot gnu dot org
` (3 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-11-25 16:55 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From cvs-commit at gcc dot gnu dot org 2004-11-25 16:55 -------
Subject: Bug 14513
CVSROOT: /cvs/gcc
Module name: gcc
Changes by: lerdsuwa@gcc.gnu.org 2004-11-25 16:55:34
Modified files:
gcc/cp : ChangeLog name-lookup.c name-lookup.h decl.c
cp-tree.h parser.c pt.c rtti.c
gcc/testsuite : ChangeLog
Added files:
gcc/testsuite/g++.dg/lookup: friend2.C
gcc/testsuite/g++.dg/template: friend31.C
Log message:
Friend class name lookup 2/n, PR c++/14513, c++/15410
* name-lookup.c (lookup_name_real): Simplify.
(lookup_type_scope): Add SCOPE parameter. Handle friend class
lookup.
* name-lookup.h (tag_scope): New enum type.
(lookup_type_scope): Adjust declaration.
* decl.c (lookup_and_check_tag, xref_tag, xref_tag_from_type):
Change bool parameter GLOBALIZED to TAG_SCOPE parameter SCOPE.
(start_enum): Likewise. Add assertion test that NAME is
IDENTIFIER_NODE. Use anonymous name for dummy ENUMERAL_TYPE in
case of error.
* cp-tree.h (xref_tag, xref_tag_from_type): Adjust declarations.
* parser.c (cp_parser_elaborated_type_specifier,
cp_parser_class_head): Adjust call to xref_tag.
* pt.c (lookup_template_class, instantiate_class_template):
Likewise.
* rtti.c (init_rtti_processing, build_dynamic_cast_1,
tinfo_base_init, emit_support_tinfos): Likewise.
* g++.dg/lookup/friend2.C: New test.
* g++.dg/template/friend31.C: Likewise.
Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.4496&r2=1.4497
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/name-lookup.c.diff?cvsroot=gcc&r1=1.93&r2=1.94
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/name-lookup.h.diff?cvsroot=gcc&r1=1.30&r2=1.31
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/decl.c.diff?cvsroot=gcc&r1=1.1332&r2=1.1333
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/cp-tree.h.diff?cvsroot=gcc&r1=1.1072&r2=1.1073
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/parser.c.diff?cvsroot=gcc&r1=1.281&r2=1.282
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/pt.c.diff?cvsroot=gcc&r1=1.947&r2=1.948
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/rtti.c.diff?cvsroot=gcc&r1=1.203&r2=1.204
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.4646&r2=1.4647
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/lookup/friend2.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/friend31.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14513
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/14513] Friend name injection problem (implicit declaration)
2004-03-10 15:42 [Bug c++/14513] New: namespace problem bugzilla-gcc at thewrittenword dot com
` (8 preceding siblings ...)
2004-11-25 16:55 ` cvs-commit at gcc dot gnu dot org
@ 2004-11-25 17:05 ` lerdsuwa at gcc dot gnu dot org
2005-01-12 19:47 ` pinskia at gcc dot gnu dot org
` (2 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: lerdsuwa at gcc dot gnu dot org @ 2004-11-25 17:05 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From lerdsuwa at gcc dot gnu dot org 2004-11-25 17:05 -------
Fixed in the mainline.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
Target Milestone|--- |4.0.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14513
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/14513] Friend name injection problem (implicit declaration)
2004-03-10 15:42 [Bug c++/14513] New: namespace problem bugzilla-gcc at thewrittenword dot com
` (9 preceding siblings ...)
2004-11-25 17:05 ` lerdsuwa at gcc dot gnu dot org
@ 2005-01-12 19:47 ` pinskia at gcc dot gnu dot org
2005-01-13 0:37 ` giovannibajo at libero dot it
2005-01-13 14:55 ` lerdsuwa at gcc dot gnu dot org
12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-01-12 19:47 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-01-12 19:47 -------
*** Bug 19403 has been marked as a duplicate of this bug. ***
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |Woebbeking at web dot de
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14513
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/14513] Friend name injection problem (implicit declaration)
2004-03-10 15:42 [Bug c++/14513] New: namespace problem bugzilla-gcc at thewrittenword dot com
` (10 preceding siblings ...)
2005-01-12 19:47 ` pinskia at gcc dot gnu dot org
@ 2005-01-13 0:37 ` giovannibajo at libero dot it
2005-01-13 14:55 ` lerdsuwa at gcc dot gnu dot org
12 siblings, 0 replies; 14+ messages in thread
From: giovannibajo at libero dot it @ 2005-01-13 0:37 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From giovannibajo at libero dot it 2005-01-13 00:37 -------
Kriang, would you please add a note to changes.html about this? I am sure it is
going to surprise many many people.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14513
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/14513] Friend name injection problem (implicit declaration)
2004-03-10 15:42 [Bug c++/14513] New: namespace problem bugzilla-gcc at thewrittenword dot com
` (11 preceding siblings ...)
2005-01-13 0:37 ` giovannibajo at libero dot it
@ 2005-01-13 14:55 ` lerdsuwa at gcc dot gnu dot org
12 siblings, 0 replies; 14+ messages in thread
From: lerdsuwa at gcc dot gnu dot org @ 2005-01-13 14:55 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From lerdsuwa at gcc dot gnu dot org 2005-01-13 14:55 -------
It is already described in changes.html:
When declaring a friend class using an unqualified name, classes outside
the innermost non-class scope are not searched ...
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14513
^ permalink raw reply [flat|nested] 14+ messages in thread