http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45329

Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2010.11.18 00:17:00
                 CC|                            |manu at gcc dot gnu.org
     Ever Confirmed|0                           |1

--- Comment #2 from Manuel López-Ibáñez <manu at gcc dot gnu.org> 2010-11-18 
00:17:00 UTC ---
(In reply to comment #1)
> I think the patch that has just been posted is awesome. 

Agreed!

> In either case, assuming that a sufficient number of arguments are
> involved and if they are all templates of the kind std::vector<std::vector<T>>
> (with all the defaulted template arguments) it becomes essentially impossible
> to see easily why the call failed.

Testcase?

> 1 pr45329.C:26:7: error: no matching function for call to 'foo(int&)'
> 2 cc1plus: note: candidates are:
> 3 pr45329.C:7:5: note: int foo(int, int)
> 4 pr45329.C:7:5:       candidate expects 2 arguments, 1 provided
> 5 pr45329.C:19:5: note: int foo(const S&)
> 6 pr45329.C:19:5:       no known conversion for argument 1 from 'int' to 
> 'const
> S&'
> (note the lack of the "note" text on lines 4,6 relative to the patch you
> posted), or

I think the lack of note would be the difficult part. I don't think we have
diagnostics without prefix. And diagnostics do not accept '\n'. 

Even if such diagnostic were implemented "note:" is a translated string, so the
indentation has to be relative to it.

> 
> 1 pr45329.C:26:7: error: no matching function for call to 'foo(int&)'
> 2 cc1plus: note: candidates are:
> 3 pr45329.C:7:5:    int foo(int, int)
> 4 pr45329.C:7:5:       reason: candidate expects 2 arguments, 1 provided
> 5 pr45329.C:19:5:   int foo(const S&)
> 6 pr45329.C:19:5:      reason: no known conversion for argument 1 from 'int' 
> to
> 'const S&'
> 
> In either case, it breaks up the long list of candidates one often gets into
> self-contained blocks that are easier to parse for the human eye.

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?

pr45329.C:26:7: error: no matching function for call to 'foo(int&)'
pr45329.C:7:5: note: candidate: int foo(int, int)
pr45329.C:7:5: note: reason: candidate expects 2 arguments, 1 provided
pr45329.C:19:5: note: candidate: int foo(const S&)
pr45329.C:19:5: note: reason: no known conversion for argument 1 from 'int' 

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.

Reply via email to