]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Backport:
authorVolker Reichelt <reichelt@netcologne.de>
Wed, 2 Jan 2008 23:47:08 +0000 (23:47 +0000)
committerVolker Reichelt <reichelt@gcc.gnu.org>
Wed, 2 Jan 2008 23:47:08 +0000 (23:47 +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.

* g++.dg/template/error31.C: New.

From-SVN: r131267

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 a794d8ab45fe14f09db379bf1c37e2b5fd7585c6..9d3332764227866a413360873252a624eff24ff5 100644 (file)
@@ -1,6 +1,14 @@
 2008-01-02  Volker Reichelt  <reichelt@netcologne.de>
 
        Backport:
+       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-18  Paolo Carlini  <pcarlini@suse.de>
 
        PR c++/33462
index 5dfd7af3f926845d3690f165645374cd7a33f2fb..4ad4d89960a5f7d2696a9a8f04d5097bd01c24fd 100644 (file)
@@ -604,7 +604,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);
@@ -615,10 +615,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 4375936cf4af05e9c8a2511540e3333d97605984..60dea036d349c06dc60487f035937e08ddb1da54 100644 (file)
@@ -71,6 +71,7 @@ void pp_cxx_declaration (cxx_pretty_printer *, tree);
 void pp_cxx_canonical_template_parameter (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 c62af6553cd6dc8a112ce3ed6920434dcb620dc2..8b8fabb8719424ea62320852bc73aadc1fad54dc 100644 (file)
@@ -1901,6 +1901,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 181938fed90e0dcbec5cfa3f224d8051365f68d6..41c7159bedff1c9f3f17f1039da85ece4ab8bf33 100644 (file)
@@ -1,6 +1,11 @@
 2008-01-02  Volker Reichelt  <reichelt@netcologne.de>
 
        Backport:
+       2007-09-27  Paolo Carlini  <pcarlini@suse.de>
+
+       PR c++/33493
+       * g++.dg/template/error31.C: New.
+
        2007-09-18  Paolo Carlini  <pcarlini@suse.de>
 
        PR c++/33462
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" }