[Bug c++/24985] caret diagnostics

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Apr 13 12:24:00 GMT 2012


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

--- Comment #45 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-04-13 12:24:30 UTC ---
(In reply to comment #42)
> Yes, I like that, too.  For reference, the following:
> 
> 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);
>                  ^

I like this for this example, but does it work as well if the function name is
very long, and the "expects 2 arguments, 1 provided" is no longer in a
predictable position, but pushed off to the right of a very long line?

t.cc: In function 'int main()':
t.cc:10:25: error: no matching function for call to 'a_long_function_name(int)'
t.cc:10:25: note: candidates are:
t.cc:5:6: note: void a_long_function_name()
t.cc:5:6: note:   candidate expects 0 arguments, 1 provided
t.cc:6:6: note: void a_long_function_name(something_verbose::my_very_long_type,
something_verbose::my_very_long_type)
t.cc:6:6: note:   candidate expects 2 arguments, 1 provided

would become

t.cc: In function 'int main()':
t.cc:10:25: error: no matching function for call to 'a_long_function_name(int)'
  a_long_function_name(1);
                        ^
t.cc:10:25: note: candidates are:
t.cc:5:6: note:   candidate 'void a_long_function_name()' expects 0 arguments,
1 provided
 void a_long_function_name();
      ^
t.cc:6:6: note: candidate 'void
a_long_function_name(something_verbose::my_very_long_type,
something_verbose::my_very_long_type)' expects 2 arguments, 1 provided
 void a_long_function_name(something_verbose::my_very_long_type,
something_verbose::my_very_long_type);
      ^

(we do already have this problem when printing ridiculous paths for stdlib
headers with superfluous lib/gcc/x86_64-unknown-linux-gnu/4.8.0/../../../..
rubbish in them, is there an existing bug for that?)



More information about the Gcc-bugs mailing list