This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/24985] caret diagnostics
- From: "manu at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 13 Apr 2012 11:54:53 +0000
- Subject: [Bug c++/24985] caret diagnostics
- Auto-submitted: auto-generated
- References: <bug-24985-4@http.gcc.gnu.org/bugzilla/>
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.