From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3170 invoked by alias); 18 Nov 2010 02:42:21 -0000 Received: (qmail 3114 invoked by uid 22791); 18 Nov 2010 02:42:20 -0000 X-SWARE-Spam-Status: No, hits=-2.8 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; Thu, 18 Nov 2010 02:42:13 +0000 From: "bangerth at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/45329] When printing a list of candidate functions, explain why each function failed to match. X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Keywords: X-Bugzilla-Severity: enhancement X-Bugzilla-Who: bangerth at gmail dot com 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" MIME-Version: 1.0 Date: Thu, 18 Nov 2010 02:45:00 -0000 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: 2010-11/txt/msg02288.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45329 --- Comment #3 from Wolfgang Bangerth 2010-11-18 02:42:01 UTC --- (In reply to comment #2) > > In either case, assuming that a sufficient number of arguments are > > involved and if they are all templates of the kind std::vector> > > (with all the defaulted template arguments) it becomes essentially impossible > > to see easily why the call failed. > > Testcase? .................... #include void f(int, std::vector &); void f(char, std::vector &); void bar() { const std::vector v; f(2,v); } ..................... x.cc: In function 'void bar()': x.cc:8:8: error: no matching function for call to 'f(int, const std::vector&)' x.cc:2:6: note: candidates are: void f(int, std::vector&) x.cc:3:6: note: void f(char, std::vector&) Previous versions of gcc printed not just std::vector but the whole std::vector> thing. > I think the lack of note would be the difficult part. I don't think we have > diagnostics without prefix. Sorry, I misremembered. All lines have 'note', but only the first has 'candidates are'. Either way, the following ones are indented which I think makes it more readable. > Even if such diagnostic were implemented "note:" is a translated string, so the > indentation has to be relative to it. But is it currently? (I.e. with the "candidates are:" string that is omitted in following lines?) > I don't see why removing the "notes: " adds/removes blocks, since it is the > same prefix every line. But I like the idea of using a "reason:" prefix, why > not a "candidate:" prefix also? I don't care how it's done but if you've stared long enough at template-laden error messages involving half a dozen function arguments of half a dozen candidate functions, you'd really appreciate some substructuring of the list. > But personally, I would prefer everything in the same line: > > pr45329.C:26:7: error: no matching function for call to 'foo(int&)' > pr45329.C:7:5: note: candidate 'int foo(int, int)' expects 2 arguments, 1 > provided > pr45329.C:19:5: note: candidate 'int foo(const S&)': no known conversion for > argument 1 from 'int' > > I think also that this latest version would require fewer testsuite changes. That would work for me as well. I think the testsuite argument is mistaken, though: the goal should be to produce quality diagnostics, not to minimize the number of changes in the testsuite. Best W.