From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25290 invoked by alias); 11 Sep 2011 20:08:02 -0000 Received: (qmail 25219 invoked by uid 22791); 11 Sep 2011 20:07:58 -0000 X-SWARE-Spam-Status: No, hits=-2.9 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 11 Sep 2011 20:07:45 +0000 From: "rui.maciel at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/50359] New: poor error message for an undeclared identifier in constructor Date: Sun, 11 Sep 2011 20:12:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: rui.maciel at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2011-09/txt/msg00782.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D50359 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: struct Foo { public: Foo(int); }; Foo::Foo(undeclared) { } int main(void) { Foo f(1); return 0; } When compiling the above code, the following error message is shown: main.c++:8:9: error: expected constructor, destructor, or type conversion before =E2=80=98(=E2=80=99 token Although the error consists of a poorly defined parameter, which may actual= ly be a simple typo, g++ complains instead about the code which was parsed bef= ore 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 whi= ch is valid.