diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index cbec7d01487..434fde6ae59 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2018-05-30 Jonathan Wakely + + PR c++/77777 + * call.c (resolve_args): Use location of expression, not current input + location. + 2018-05-30 Ville Voutilainen Do not warn about zero-as-null when NULL is used. diff --git a/gcc/cp/call.c b/gcc/cp/call.c index 98319f98c7d..d222b41c060 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -4147,7 +4147,7 @@ resolve_args (vec *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; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 338cbb254b3..af97797b0f8 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-05-30 Jonathan Wakely + + PR c++/77777 + * g++.dg/diagnostic/pr77777.C: New test. + 2018-05-30 David Pagan PR c/55976 diff --git a/gcc/testsuite/g++.dg/diagnostic/pr77777.C b/gcc/testsuite/g++.dg/diagnostic/pr77777.C new file mode 100644 index 00000000000..0e7676d5819 --- /dev/null +++ b/gcc/testsuite/g++.dg/diagnostic/pr77777.C @@ -0,0 +1,16 @@ +// 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" } + ); +}