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

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).