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

--- Comment #32 from Manuel López-Ibáñez <manu at gcc dot gnu.org> 2012-04-12 
21:58:59 UTC ---
(In reply to comment #31)
> The effect of this patch on overload resolution diagnostics is problematic:
> wa2.C: In function ‘int main()’:
> wa2.C:6:6: error: no matching function for call to ‘f(int)’
>    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);
>       ^
> 
> When there are multiple diagnostics at the same input location, we should only
> print the source/caret information once.

True. Actually, in this case, perhaps we should print:

 wa2.C:6:6: error: no matching function for call to ‘f(int)’
    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);
       ^

no? Any other suggestions?

We could also print the %qD in the same line as:

 wa2.C:6:6: error: no matching function for call to ‘f(int)’
    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);
       ^

What do you think?

Reply via email to