This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[C++ PATCH] Fix diagnostic printing of AGGR_INIT_EXPR (PR c++/30854)
- From: Jakub Jelinek <jakub at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Wed, 4 Jul 2007 07:24:41 -0400
- Subject: [C++ PATCH] Fix diagnostic printing of AGGR_INIT_EXPR (PR c++/30854)
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
Hi!
Before http://gcc.gnu.org/ml/gcc-patches/2007-02/msg01267.html
AGGR_INIT_EXPR arguments were dumped in error.c through:
pp_cxx_left_paren (cxx_pp);
if (TREE_OPERAND (t, 1))
dump_expr_list (TREE_CHAIN (TREE_OPERAND (t, 1)), flags);
pp_cxx_right_paren (cxx_pp);
i.e. the first operand (instance pointer) was always skipped.
But now it is never skipped.
The following patch fixes this (tested on x86_64-linux), though
perhaps it might be better idea to just remove that argument
from dump_aggr_init_expr_args altogether and just hardcode
skipping of the first argument in that function. dump_aggr_init_expr_args
has just one caller and is static function...
Ok for trunk (or ok with removing the skipfirst argument)?
2007-07-04 Jakub Jelinek <jakub@redhat.com>
PR c++/30854
* error.c (dump_expr) <case AGGR_INIT_EXPR>: Pass true as last
argument to dump_aggr_init_expr_args instead of false.
* g++.dg/parse/error30.C: New test.
--- gcc/cp/error.c.jj 2007-07-04 12:38:26.000000000 +0200
+++ gcc/cp/error.c 2007-07-04 12:52:33.000000000 +0200
@@ -1520,7 +1520,7 @@ dump_expr (tree t, int flags)
else
dump_expr (AGGR_INIT_EXPR_FN (t), 0);
}
- dump_aggr_init_expr_args (t, flags, false);
+ dump_aggr_init_expr_args (t, flags, true);
break;
case CALL_EXPR:
--- gcc/testsuite/g++.dg/parse/error30.C.jj 2007-07-04 12:56:55.000000000 +0200
+++ gcc/testsuite/g++.dg/parse/error30.C 2007-07-04 13:03:10.000000000 +0200
@@ -0,0 +1,11 @@
+// PR c++/30854
+// { dg-do compile }
+
+struct A
+{
+ A();
+ A(int);
+};
+
+A a = -A(); // { dg-error "no match for.*operator-.*in.*-A\\(\\)" }
+A b = -A(5); // { dg-error "no match for.*operator-.*in.*-A\\(5\\)" }
Jakub