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

--- Comment #39 from Manuel López-Ibáñez <manu at gcc dot gnu.org> 2012-04-13 
11:54:53 UTC ---
(In reply to comment #36)
> Sounds good to me.  But I think GNU conventions require a location here?

Well, if that is a hard requirement, I can just suppress the caret. Or we can
just not print the "note: candidates are:". It seems superfluous info to me.

> > > 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.
> > 
> > Could you explain why?
> 
> Because void f(int, int) is not of type "candidate expects 0 arguments" but
> it is of expects two which is duplicate of the following
> 
> t.C:1:17: note:   candidate expects 2 arguments, 1 provided
>  void f();  void f(int,int);
>                  ^
> 
> But that's of course a different bug.

I see. The problem is that the output is meant to be read as (locations and
duplicated carets removed for clarity):

note: candidates are:
note: candidate #1 is void f()
 void f();  void f(int,int);
      ^
note:  candidate #1 expects 0 arguments, 1 provided
note: candidate #2 is void f(int, int)
 void f();  void f(int,int);
                 ^
note:   candidate #2 expects 2 arguments, 1 provided

that is, first print the candidate, then the reason for failure. If you read
again the original, the 2nd and 3rd notes go together, like the 4th and 5th, so
the output is correct (although I agree that quite confusing). That is why I
proposed:

note: candidate 'void f()' expects 0 arguments, 1 provided
 void f();  void f(int,int);
      ^
note:  candidate 'void f(int, int)' expects 2 arguments, 1 provided
 void f();  void f(int,int);
                 ^

(that is, instead of two notes per candidate, just one). Or we could number the
candidates like above.

Reply via email to