diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2018-05-31 00:13:48 +0100 |
---|---|---|
committer | Jonathan Wakely <redi@gcc.gnu.org> | 2018-05-31 00:13:48 +0100 |
commit | d72a3672c5450f76ca056b0bcc45b8dd55965802 (patch) | |
tree | 6b69441661652d6e8a63c134717bbe9eaf3f1894 | |
parent | b67b9225f72e4b2d58e535c78dbeff83f94c8f66 (diff) | |
download | gcc-d72a3672c5450f76ca056b0bcc45b8dd55965802.zip gcc-d72a3672c5450f76ca056b0bcc45b8dd55965802.tar.gz gcc-d72a3672c5450f76ca056b0bcc45b8dd55965802.tar.bz2 |
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
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/call.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/diagnostic/pr77777.C | 16 |
4 files changed, 28 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index cbec7d0..434fde6 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +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. diff --git a/gcc/cp/call.c b/gcc/cp/call.c index 98319f9..d222b41 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -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; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 338cbb2..af97797 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +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 diff --git a/gcc/testsuite/g++.dg/diagnostic/pr77777.C b/gcc/testsuite/g++.dg/diagnostic/pr77777.C new file mode 100644 index 0000000..0e7676d --- /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" } + ); +} |