From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12119 invoked by alias); 21 Sep 2011 15:30:46 -0000 Received: (qmail 12109 invoked by uid 22791); 21 Sep 2011 15:30:45 -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; Wed, 21 Sep 2011 15:30:31 +0000 From: "manu at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/10618] Error message for function declarations with invalid return type could be improved Date: Wed, 21 Sep 2011 15:39:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: enhancement X-Bugzilla-Who: manu at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: giovannibajo at libero dot it X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: 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/msg01467.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D10618 --- Comment #9 from Manuel L=C3=B3pez-Ib=C3=A1=C3=B1ez 2011-09-21 15:30:26 UTC --- >=20 > > test.cc:12:1: error: need =E2=80=98typename=E2=80=99 before =E2=80=98A<= T>::k=E2=80=99 because =E2=80=98A=E2=80=99 is a > > dependent scope > > test.cc:14:6: error: expected constructor, destructor, or type conversi= on > > before =E2=80=98func2=E2=80=99 >=20 > > Clang gives the correct output: > >=20 > > /tmp/webcompile/_10395_0.cc:12:1: error: missing 'typename' prior to de= pendent > > type name 'A::k' > > A::k func1();=20 > > ^~~~~~~ > > typename=20 > > /tmp/webcompile/_10395_0.cc:14:4: error: no type named 'k' in 'B' > > B::k func2(); > > ~~~^ > > 2 errors generated. >=20 > Huh? This is the same as G++'s output >=20 The second diagnostic from G++ does not make sense. Clang gives the correct diagnostics in that case. > If you instantiate the function template G++ trunk gives a better diagnos= tic > than clang 3.0 Great! Let's say this is almost fixed then.