This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[C++ Patch] PR 33493


Hi,

another small diagnostic problem, usual approach... Tested x86_64-linux.

Ok for mainline?

Paolo.

////////////////
/cp
2007-09-26  Paolo Carlini  <pcarlini@suse.de>

	PR c++/33493
	* error.c (dump_expr): Deal with DELETE_EXPR and VEC_DELETE_EXPR.
	* cxx-pretty-print.c (pp_cxx_delete_expression): Add missing
	spaces in the formatting.
	* cxx-pretty-print.h (pp_cxx_delete_expression): Declare.

/testsuite
2007-09-26  Paolo Carlini  <pcarlini@suse.de>

	PR c++/33493
	* g++.dg/template/error31.C: New.
Index: testsuite/g++.dg/template/error31.C
===================================================================
*** testsuite/g++.dg/template/error31.C	(revision 0)
--- testsuite/g++.dg/template/error31.C	(revision 0)
***************
*** 0 ****
--- 1,3 ----
+ // PR c++/33493
+ 
+ template<int> void foo() { delete 0 ? 1 : 0; } // { dg-error "delete 0" }
Index: cp/error.c
===================================================================
*** cp/error.c	(revision 128735)
--- cp/error.c	(working copy)
*************** dump_expr (tree t, int flags)
*** 2066,2071 ****
--- 2047,2057 ----
        pp_cxx_va_arg_expression (cxx_pp, t);
        break;
  
+     case DELETE_EXPR:
+     case VEC_DELETE_EXPR:
+       pp_cxx_delete_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 128735)
--- cp/cxx-pretty-print.c	(working copy)
*************** pp_cxx_new_expression (cxx_pretty_printe
*** 662,668 ****
        ::(opt) delete cast-expression
        ::(opt) delete [ ] cast-expression   */
  
! static void
  pp_cxx_delete_expression (cxx_pretty_printer *pp, tree t)
  {
    enum tree_code code = TREE_CODE (t);
--- 662,668 ----
        ::(opt) delete cast-expression
        ::(opt) delete [ ] cast-expression   */
  
! void
  pp_cxx_delete_expression (cxx_pretty_printer *pp, tree t)
  {
    enum tree_code code = TREE_CODE (t);
*************** pp_cxx_delete_expression (cxx_pretty_pri
*** 673,682 ****
        if (DELETE_EXPR_USE_GLOBAL (t))
  	pp_cxx_colon_colon (pp);
        pp_cxx_identifier (pp, "delete");
!       if (code == VEC_DELETE_EXPR)
  	{
  	  pp_left_bracket (pp);
  	  pp_right_bracket (pp);
  	}
        pp_c_cast_expression (pp_c_base (pp), TREE_OPERAND (t, 0));
        break;
--- 673,685 ----
        if (DELETE_EXPR_USE_GLOBAL (t))
  	pp_cxx_colon_colon (pp);
        pp_cxx_identifier (pp, "delete");
!       pp_space (pp);
!       if (code == VEC_DELETE_EXPR
! 	  || DELETE_EXPR_USE_VEC (t))
  	{
  	  pp_left_bracket (pp);
  	  pp_right_bracket (pp);
+ 	  pp_space (pp);
  	}
        pp_c_cast_expression (pp_c_base (pp), TREE_OPERAND (t, 0));
        break;
Index: cp/cxx-pretty-print.h
===================================================================
*** cp/cxx-pretty-print.h	(revision 128735)
--- cp/cxx-pretty-print.h	(working copy)
*************** void pp_cxx_canonical_template_parameter
*** 72,76 ****
--- 72,77 ----
  void pp_cxx_trait_expression (cxx_pretty_printer *, tree);
  void pp_cxx_typeid_expression (cxx_pretty_printer *, tree);
  void pp_cxx_va_arg_expression (cxx_pretty_printer *, tree);
+ void pp_cxx_delete_expression (cxx_pretty_printer *, tree);
  
  #endif /* GCC_CXX_PRETTY_PRINT_H */

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]