public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c++/8891: Unexplicit error message about naming conflict
@ 2002-12-10 6:55 bangerth
0 siblings, 0 replies; 2+ messages in thread
From: bangerth @ 2002-12-10 6:55 UTC (permalink / raw)
To: benoit.sibaud, gcc-bugs, gcc-prs, nobody
Synopsis: Unexplicit error message about naming conflict
State-Changed-From-To: open->feedback
State-Changed-By: bangerth
State-Changed-When: Tue Dec 10 06:55:08 2002
State-Changed-Why:
I don't know what to do with this report, since the message
is probably the best you can get. In any case, there is
no _naming conflict_: declaring an enum member and a
class with the same name is just fine, it's only when you
access that you have to make clear what you want: by
default, lookup happens _within_ the class, so you get
the enum name, which of course does not go well with the
"operator new". If you want the class name, you have to
specify that:
Foo* fct() { return new ::BadName; }
This compiles just fine.
So what you request is that upon seeing the bogus
new enum-value;
line, the compiler looks up whether somewhere, outside of
its usual search area, there is class name with the same
name as that enum value. I think this is asking for too
much.
Maybe someone of the C++ front end guys can comment on what
we should do with this request.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=8891
^ permalink raw reply [flat|nested] 2+ messages in thread
* c++/8891: Unexplicit error message about naming conflict
@ 2002-12-10 6:36 benoit.sibaud
0 siblings, 0 replies; 2+ messages in thread
From: benoit.sibaud @ 2002-12-10 6:36 UTC (permalink / raw)
To: gcc-gnats
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1111 bytes --]
>Number: 8891
>Category: c++
>Synopsis: Unexplicit error message about naming conflict
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Tue Dec 10 06:36:04 PST 2002
>Closed-Date:
>Last-Modified:
>Originator: Benoît Sibaud
>Release: gcc-3.2.1
>Organization:
>Environment:
Debian Sarge i686-pc-linux-gnu
>Description:
class Foo
{
protected:
enum {BadName, A, B, C};
};
class BadName : public Foo
{
};
class Toto : public Foo
{
public:
Foo* fct() { return new BadName; }
};
$ g++ -Wall foo.cpp
foo.cpp: In member function `Foo* Toto::fct()':
foo.cpp:18: parse error before `;' token
foo.cpp:18: warning: no return statement in function returning non-void
Conflict between ::BadName and BadName in Foo enum. The error message is not really helpful (the enum was deeply hidden in a class hierarchy in my case).
Tested with several 2.95.2, 3.0.x, 3.1.x and 3.2.x versions.
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2002-12-10 14:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-12-10 6:55 c++/8891: Unexplicit error message about naming conflict bangerth
-- strict thread matches above, loose matches on Subject: below --
2002-12-10 6:36 benoit.sibaud
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).