From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14484 invoked by alias); 13 Apr 2012 09:57:23 -0000 Received: (qmail 14474 invoked by uid 22791); 13 Apr 2012 09:57:21 -0000 X-SWARE-Spam-Status: No, hits=-4.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,KHOP_THREADED 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; Fri, 13 Apr 2012 09:57:08 +0000 From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/24985] caret diagnostics Date: Fri, 13 Apr 2012 09:57: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: rguenth at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org 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: 2012-04/txt/msg00987.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D24985 --- Comment #34 from Richard Guenther 2012-04-= 13 09:56:48 UTC --- (In reply to comment #32) > (In reply to comment #31) > > The effect of this patch on overload resolution diagnostics is problema= tic: > > wa2.C: In function =E2=80=98int main()=E2=80=99: > > wa2.C:6:6: error: no matching function for call to =E2=80=98f(int)=E2= =80=99 > > f(1); > > ^ > > wa2.C:6:6: note: candidates are: > > f(1); > > ^ > > wa2.C:1:6: note: void f() > > void f(); > > ^ > > wa2.C:1:6: note: candidate expects 0 arguments, 1 provided > > void f(); > > ^ > > wa2.C:2:6: note: void f(int, int) > > void f(int,int); > > ^ > > wa2.C:2:6: note: candidate expects 2 arguments, 1 provided > > void f(int,int); > > ^ > >=20 > > When there are multiple diagnostics at the same input location, we shou= ld only > > print the source/caret information once. >=20 > True. Actually, in this case, perhaps we should print: >=20 > wa2.C:6:6: error: no matching function for call to =E2=80=98f(int)=E2=80= =99 > f(1); > ^ > note: candidates are: > wa2.C:1:6: note: candidate expects 0 arguments, 1 provided > void f(); > ^ > wa2.C:2:6: note: candidate expects 2 arguments, 1 provided > void f(int,int); > ^ >=20 > no? Any other suggestions? >=20 > We could also print the %qD in the same line as: >=20 > wa2.C:6:6: error: no matching function for call to =E2=80=98f(int)=E2=80= =99 > f(1); > ^ > note: candidates are: > wa2.C:1:6: note: candidate 'void f()' expects 0 arguments, 1 provided > void f(); > ^ > wa2.C:2:6: note: candidate 'void f(int, int)' expects 2 arguments, 1 > provided > void f(int,int); > ^ >=20 > What do you think? I think we should simply omit carets for all 'note's for now and add a way for the callers to suppress carets. Though if you consider the testcase changed to void f(); void f(int,int); int main() { f(1); } then suddenly the carets get more useful and the situation less clear: t.C: In function 'int main()': t.C:5:6: error: no matching function for call to 'f(int)' f(1); ^ t.C:5:6: note: candidates are: f(1); ^ t.C:1:6: note: void f() void f(); void f(int,int); ^ t.C:1:6: note: candidate expects 0 arguments, 1 provided void f(); void f(int,int); ^ t.C:1:17: note: void f(int, int) void f(); void f(int,int); ^ t.C:1:17: note: candidate expects 2 arguments, 1 provided void f(); void f(int,int); ^ btw, why do we print a location info for t.C:5:6: note: candidates are: f(1); ^ at all? t.C:1:6: note: candidate expects 0 arguments, 1 provided void f(); void f(int,int); ^ t.C:1:17: note: void f(int, int) void f(); void f(int,int); ^ and the 2nd note here looks wrong.