From 05f30b866f8d44acabc08dcd045712afc40445a4 Mon Sep 17 00:00:00 2001 From: Marek Polacek Date: Sat, 13 Sep 2014 07:54:40 +0000 Subject: [PATCH] re PR c++/60862 (bad location in invalid conversion error) PR c++/60862 * parser.c (cp_parser_postfix_expression) : Set location of a call expression. * g++.dg/diagnostic/pr60862.C: New test. From-SVN: r215235 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/parser.c | 2 ++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/diagnostic/pr60862.C | 10 ++++++++++ 4 files changed, 23 insertions(+) create mode 100644 gcc/testsuite/g++.dg/diagnostic/pr60862.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 3e9cb896824..ff72fd01a8f 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2014-09-13 Marek Polacek + + PR c++/60862 + * parser.c (cp_parser_postfix_expression) : Set + location of a call expression. + 2014-09-11 Jason Merrill PR c++/63201 diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index c696fd2e6be..a3c947a9a69 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -6227,6 +6227,8 @@ cp_parser_postfix_expression (cp_parser *parser, bool address_p, bool cast_p, koenig_p, complain); + protected_set_expr_location (postfix_expression, token->location); + /* The POSTFIX_EXPRESSION is certainly no longer an id. */ idk = CP_ID_KIND_NONE; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 20defa5bc3e..29d89a8b2c1 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2014-09-13 Marek Polacek + + PR c++/60862 + * g++.dg/diagnostic/pr60862.C: New test. + 2014-09-12 Richard Biener PR middle-end/63237 diff --git a/gcc/testsuite/g++.dg/diagnostic/pr60862.C b/gcc/testsuite/g++.dg/diagnostic/pr60862.C new file mode 100644 index 00000000000..cc5279cde6b --- /dev/null +++ b/gcc/testsuite/g++.dg/diagnostic/pr60862.C @@ -0,0 +1,10 @@ +// PR c++/60862 +// { dg-do compile } + +extern void **bar (int, void *, int); + +void +foo (int x, int y) +{ + int **s = bar (x, &x, y); // { dg-error "17:invalid conversion" } +} -- 2.30.2