g++: conflicting uses of namespace name not reported
Gabriel Dos Reis
gdr@integrable-solutions.net
Sat Feb 7 17:25:00 GMT 2004
Ken Raeburn <raeburn@raeburn.org> writes:
| I reported this before in
| http://gcc.gnu.org/ml/gcc-bugs/2000-07/msg00683.html against 2.96, but
| it appears not to be in the bugzilla database, and still appears to be
| broken in "GCC: (GNU) 3.2.2 20030222 (Red Hat Linux 3.2.2-5)" and
| "GCC: (GNU) 3.3.2 (NetBSD nb1 20031026)" according to the .ident
| strings output on a couple of systems. I'm checking out a fresh copy
| from the GCC CVS repository, but it's taking a long time...
|
| Defining a class and a namespace by the same name is not flagged as
| an error by the C++ compiler, even though variables by the same names
| can be created in each, and will cause an assembly-time error.
|
| class X { static int x; };
| int X::x = 42;
| namespace X { int x = 3; };
Funny, you should mention this. I've just been discussing this
specific example with Giovanni yesterday. This is a serious defect
in the way we do handle name declarations in g++. I'm taking this over .
[...]
| If you check the followups to my original report, Alex Samuel
| indicated that the error appears to be in the compiler accepting this
| file, not in failing to generate distinct names.
And Alex is right. The code should not have been accepted in the
first place.
-- Gaby
More information about the Gcc-bugs
mailing list