Verbose "invalid argument"?

Xi Ruoyao ryxi@stu.xidian.edu.cn
Mon Nov 27 10:59:00 GMT 2017


On 2017-11-27 09:52 +0000, Andrea Campanella wrote:
> Hello everyone,
> 
> I was wondering if is possible to force gcc to be more verbose in the
> "invalid argument " error.
> 
> At the moment,  the output is something like that :
> 
> Invalid arguments '
> Candidates are:
> long int sendto(int, const void *, unsigned long int, int, const sockaddr
> *, unsigned int)
> 
> 
> Is it possible to show something like "argument number 3 : ‘uint32_t {aka
> unsigned int}’ to ‘const void*’ "
> 
> Notice: I would like to have the number of the argument with the error,
> would be possible?

There is the number of the argument, I think.

~~~~~
$ cat test.cc
int foo(char *x);
int foo(int *x);

int bar()
{
	return foo(1.0);
}
$ LANG= g++-5.3 test.cc
test.cc: In function 'int bar()':
test.cc:6:16: error: no matching function for call to 'foo(double)'
  return foo(1.0);
                ^
test.cc:1:5: note: candidate: int foo(char*)
 int foo(char *x);
     ^
test.cc:1:5: note:   no known conversion for argument 1 from 'double' to 'char*'
test.cc:2:5: note: candidate: int foo(int*)
 int foo(int *x);
     ^
test.cc:2:5: note:   no known conversion for argument 1 from 'double' to 'int*'
~~~~~

> I'm using gcc 5.
> 
> Thank you!
> 
> 
-- 
Xi Ruoyao <ryxi@stu.xidian.edu.cn>
School of Aerospace Science and Technology, Xidian University



More information about the Gcc-help mailing list