public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/50359] New: poor error message for an undeclared identifier in constructor
@ 2011-09-11 20:12 rui.maciel at gmail dot com
2012-04-12 12:24 ` [Bug c++/50359] " redi at gcc dot gnu.org
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: rui.maciel at gmail dot com @ 2011-09-11 20:12 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50359
Bug #: 50359
Summary: poor error message for an undeclared identifier in
constructor
Classification: Unclassified
Product: gcc
Version: 4.5.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: rui.maciel@gmail.com
Consider the following code:
<code>
struct Foo
{
public:
Foo(int);
};
Foo::Foo(undeclared)
{
}
int main(void)
{
Foo f(1);
return 0;
}
</code>
When compiling the above code, the following error message is shown:
<message>
main.c++:8:9: error: expected constructor, destructor, or type conversion
before ‘(’ token
</message>
Although the error consists of a poorly defined parameter, which may actually
be a simple typo, g++ complains instead about the code which was parsed before
the '(' token, which is actually (at least to the best of my knowledge)
correct.
It would be nice if GCC informed the user about an undeclared identifier
instead of throwing a cryptic message regarding the portion of the code which
is valid.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/50359] poor error message for an undeclared identifier in constructor
2011-09-11 20:12 [Bug c++/50359] New: poor error message for an undeclared identifier in constructor rui.maciel at gmail dot com
@ 2012-04-12 12:24 ` redi at gcc dot gnu.org
2012-05-08 13:35 ` rui.maciel at gmail dot com
2012-05-09 11:45 ` manu at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: redi at gcc dot gnu.org @ 2012-04-12 12:24 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50359
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |diagnostic
Status|UNCONFIRMED |NEW
Last reconfirmed| |2012-04-12
Ever Confirmed|0 |1
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-04-12 12:23:38 UTC ---
Confirmed. Clang doesn't do much better, but EDG is very good:
"ComeauTest.c", line 8: error: identifier "undeclared" is undefined
Foo::Foo(undeclared)
^
"ComeauTest.c", line 8: error: no instance of overloaded function "Foo::Foo"
matches
the specified type
Foo::Foo(undeclared)
^
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/50359] poor error message for an undeclared identifier in constructor
2011-09-11 20:12 [Bug c++/50359] New: poor error message for an undeclared identifier in constructor rui.maciel at gmail dot com
2012-04-12 12:24 ` [Bug c++/50359] " redi at gcc dot gnu.org
@ 2012-05-08 13:35 ` rui.maciel at gmail dot com
2012-05-09 11:45 ` manu at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: rui.maciel at gmail dot com @ 2012-05-08 13:35 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50359
--- Comment #2 from Rui Maciel <rui.maciel at gmail dot com> 2012-05-08 13:33:57 UTC ---
This issue is still present in g++ 4.6.3.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/50359] poor error message for an undeclared identifier in constructor
2011-09-11 20:12 [Bug c++/50359] New: poor error message for an undeclared identifier in constructor rui.maciel at gmail dot com
2012-04-12 12:24 ` [Bug c++/50359] " redi at gcc dot gnu.org
2012-05-08 13:35 ` rui.maciel at gmail dot com
@ 2012-05-09 11:45 ` manu at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: manu at gcc dot gnu.org @ 2012-05-09 11:45 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50359
Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |manu at gcc dot gnu.org
Known to fail| |4.7.1
--- Comment #3 from Manuel López-Ibáñez <manu at gcc dot gnu.org> 2012-05-09 11:10:21 UTC ---
And in G++ 4.8.0.
I guess this has something to do with tentative parsing, but someone would need
to launch GDB and investigate what goes wrong in detail.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-05-09 11:10 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-11 20:12 [Bug c++/50359] New: poor error message for an undeclared identifier in constructor rui.maciel at gmail dot com
2012-04-12 12:24 ` [Bug c++/50359] " redi at gcc dot gnu.org
2012-05-08 13:35 ` rui.maciel at gmail dot com
2012-05-09 11:45 ` manu at gcc dot gnu.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).