OSDN Git Service

/cp
authorpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 27 Sep 2007 09:20:59 +0000 (09:20 +0000)
committerpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 27 Sep 2007 09:20:59 +0000 (09:20 +0000)
2007-09-27  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-27  Paolo Carlini  <pcarlini@suse.de>

PR c++/33493
* g++.dg/template/error31.C: New.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@128831 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/cxx-pretty-print.c
gcc/cp/cxx-pretty-print.h
gcc/cp/error.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/template/error31.C [new file with mode: 0644]

index 915ac9e..f459c54 100644 (file)
@@ -1,3 +1,11 @@
+2007-09-27  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.
+
 2007-09-27  Jakub Jelinek  <jakub@redhat.com>
 
        * error.c (cxx_print_error_function): Add third argument, pass
index 9a27ae8..6481273 100644 (file)
@@ -662,7 +662,7 @@ pp_cxx_new_expression (cxx_pretty_printer *pp, tree t)
       ::(opt) delete cast-expression
       ::(opt) delete [ ] cast-expression   */
 
-static void
+void
 pp_cxx_delete_expression (cxx_pretty_printer *pp, tree t)
 {
   enum tree_code code = TREE_CODE (t);
@@ -673,10 +673,13 @@ pp_cxx_delete_expression (cxx_pretty_printer *pp, tree t)
       if (DELETE_EXPR_USE_GLOBAL (t))
        pp_cxx_colon_colon (pp);
       pp_cxx_identifier (pp, "delete");
-      if (code == VEC_DELETE_EXPR)
+      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 b653376..66943ac 100644 (file)
@@ -72,5 +72,6 @@ void pp_cxx_canonical_template_parameter (cxx_pretty_printer *, tree);
 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 24f1d83..4337d4d 100644 (file)
@@ -2066,6 +2066,11 @@ dump_expr (tree t, int flags)
       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 ec014ea..c74f899 100644 (file)
@@ -1,3 +1,8 @@
+2007-09-27  Paolo Carlini  <pcarlini@suse.de>
+
+       PR c++/33493
+       * g++.dg/template/error31.C: New.
+
 2007-09-27  Jakub Jelinek  <jakub@redhat.com>
 
        * lib/prune.exp: Prune also "^In function .*$" lines and
diff --git a/gcc/testsuite/g++.dg/template/error31.C b/gcc/testsuite/g++.dg/template/error31.C
new file mode 100644 (file)
index 0000000..4fd7026
--- /dev/null
@@ -0,0 +1,3 @@
+// PR c++/33493
+
+template<int> void foo() { delete 0 ? 1 : 0; } // { dg-error "delete 0" }