Commit d72a3672 by Jonathan Wakely Committed by Jonathan Wakely

PR c++/77777 improve location for diagnostic

Pass in the location of the invalid expression, not the next input
location (which might be a comma or closing parenthesis on a different
line).

gcc/cp:

	PR c++/77777
	* call.c (resolve_args): Use location of expression, not current input
	location.

gcc/testsuite:

	PR c++/77777
	* g++.dg/diagnostic/pr77777.C: New test.

From-SVN: r260979
parent b67b9225
2018-05-30 Jonathan Wakely <jwakely@redhat.com>
PR c++/77777
* call.c (resolve_args): Use location of expression, not current input
location.
2018-05-30 Ville Voutilainen <ville.voutilainen@gmail.com>
Do not warn about zero-as-null when NULL is used.
......
......@@ -4147,7 +4147,7 @@ resolve_args (vec<tree, va_gc> *args, tsubst_flags_t complain)
error ("invalid use of void expression");
return NULL;
}
else if (invalid_nonstatic_memfn_p (input_location, arg, complain))
else if (invalid_nonstatic_memfn_p (arg->exp.locus, arg, complain))
return NULL;
}
return args;
......
2018-05-30 Jonathan Wakely <jwakely@redhat.com>
PR c++/77777
* g++.dg/diagnostic/pr77777.C: New test.
2018-05-30 David Pagan <dave.pagan@oracle.com>
PR c/55976
......
// PR c++/77777
// { dg-do compile }
struct X {
int f();
};
void g(int);
int main()
{
X x;
g(
x.f // { dg-error "invalid use of non-static member function" }
);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment