This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[C++, diagnostic] PR 33494
- From: Paolo Carlini <pcarlini at suse dot de>
- To: Gcc Patch List <gcc-patches at gcc dot gnu dot org>
- Cc: gdr at cs dot tamu dot edu
- Date: Mon, 29 Oct 2007 12:12:33 +0100
- Subject: [C++, diagnostic] PR 33494
Hi all, hi Gaby,
another small diagnostic issue, cxx-pretty-print already deals with
modop_expr.
Tested x86_64-linux. Ok for mainline?
Paolo.
////////////////
/cp
2007-10-29 Paolo Carlini <pcarlini@suse.de>
PR c++/33494
* cxx-pretty-print.c (pp_cxx_modop_expression): Split out from...
(pp_cxx_assignment_expression): ... here, adjust.
* cxx-pretty-print.h (pp_cxx_modop_expression): Declare.
* error.c (dump_expr): Use it.
/testsuite
2007-10-29 Paolo Carlini <pcarlini@suse.de>
PR c++/33494
* g++.dg/template/error35.C: New.
Index: testsuite/g++.dg/template/error35.C
===================================================================
*** testsuite/g++.dg/template/error35.C (revision 0)
--- testsuite/g++.dg/template/error35.C (revision 0)
***************
*** 0 ****
--- 1,3 ----
+ // PR c++/33494
+
+ template<int> void foo(int(*f=0)()); // { dg-error "declared void|scope|erroneous-expression" }
Index: cp/error.c
===================================================================
*** cp/error.c (revision 129707)
--- cp/error.c (working copy)
*************** dump_expr (tree t, int flags)
*** 2062,2067 ****
--- 2062,2071 ----
pp_cxx_delete_expression (cxx_pp, t);
break;
+ case MODOP_EXPR:
+ pp_cxx_modop_expression (cxx_pp, t);
+ break;
+
/* This list is incomplete, but should suffice for now.
It is very important that `sorry' does not call
`report_error_function'. That could cause an infinite loop. */
Index: cp/cxx-pretty-print.c
===================================================================
*** cp/cxx-pretty-print.c (revision 129715)
--- cp/cxx-pretty-print.c (working copy)
*************** pp_cxx_assignment_expression (cxx_pretty
*** 953,961 ****
break;
case MODOP_EXPR:
! pp_c_logical_or_expression (pp_c_base (pp), TREE_OPERAND (e, 0));
! pp_cxx_assignment_operator (pp, TREE_OPERAND (e, 1));
! pp_cxx_assignment_expression (pp, TREE_OPERAND (e, 2));
break;
default:
--- 953,959 ----
break;
case MODOP_EXPR:
! pp_cxx_modop_expression (pp, e);
break;
default:
*************** pp_cxx_va_arg_expression (cxx_pretty_pri
*** 2185,2190 ****
--- 2183,2196 ----
pp_cxx_right_paren (pp);
}
+ void
+ pp_cxx_modop_expression (cxx_pretty_printer *pp, tree t)
+ {
+ pp_c_logical_or_expression (pp_c_base (pp), TREE_OPERAND (t, 0));
+ pp_cxx_assignment_operator (pp, TREE_OPERAND (t, 1));
+ pp_cxx_assignment_expression (pp, TREE_OPERAND (t, 2));
+ }
+
static bool
pp_cxx_offsetof_expression_1 (cxx_pretty_printer *pp, tree t)
{
Index: cp/cxx-pretty-print.h
===================================================================
*** cp/cxx-pretty-print.h (revision 129715)
--- cp/cxx-pretty-print.h (working copy)
*************** void pp_cxx_typeid_expression (cxx_prett
*** 74,78 ****
--- 74,79 ----
void pp_cxx_va_arg_expression (cxx_pretty_printer *, tree);
void pp_cxx_offsetof_expression (cxx_pretty_printer *, tree);
void pp_cxx_delete_expression (cxx_pretty_printer *, tree);
+ void pp_cxx_modop_expression (cxx_pretty_printer *, tree);
#endif /* GCC_CXX_PRETTY_PRINT_H */