re PR c++/60862 (bad location in invalid conversion error)
authorMarek Polacek <polacek@redhat.com>
Sat, 13 Sep 2014 07:54:40 +0000 (07:54 +0000)
committerMarek Polacek <mpolacek@gcc.gnu.org>
Sat, 13 Sep 2014 07:54:40 +0000 (07:54 +0000)
PR c++/60862
* parser.c (cp_parser_postfix_expression) <case CPP_OPEN_PAREN>: Set
location of a call expression.

* g++.dg/diagnostic/pr60862.C: New test.

From-SVN: r215235

gcc/cp/ChangeLog
gcc/cp/parser.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/diagnostic/pr60862.C [new file with mode: 0644]

index 3e9cb8968240f5082e15ae15eaf51342683343f7..ff72fd01a8fd6b03ae4fda60704f1b8be3926d00 100644 (file)
@@ -1,3 +1,9 @@
+2014-09-13  Marek Polacek  <polacek@redhat.com>
+
+       PR c++/60862
+       * parser.c (cp_parser_postfix_expression) <case CPP_OPEN_PAREN>: Set
+       location of a call expression.
+
 2014-09-11  Jason Merrill  <jason@redhat.com>
 
        PR c++/63201
index c696fd2e6be3135bca3385f35011e3470f69ffb4..a3c947a9a6908d5a987e5847a9124467eda82398 100644 (file)
@@ -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;
 
index 20defa5bc3ec3278a18fed5f9172a0d30ceb3812..29d89a8b2c1eb74582e64bbe19567c9713bdfd9d 100644 (file)
@@ -1,3 +1,8 @@
+2014-09-13  Marek Polacek  <polacek@redhat.com>
+
+       PR c++/60862
+       * g++.dg/diagnostic/pr60862.C: New test.
+
 2014-09-12  Richard Biener  <rguenther@suse.de>
 
        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 (file)
index 0000000..cc5279c
--- /dev/null
@@ -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" }
+}