OSDN Git Service

PR c++/21930
authorsayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 12 Jun 2005 23:46:46 +0000 (23:46 +0000)
committersayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 12 Jun 2005 23:46:46 +0000 (23:46 +0000)
* error.c (dump_expr): UNARY_PLUS_EXPR need not handle void types.
Treat CONVERT_EXPR identically to NOP_EXPR.

* g++.dg/other/error10.C: New test case.

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

gcc/cp/ChangeLog
gcc/cp/error.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/other/error10.C [new file with mode: 0644]

index 82b0ee2..fa37b36 100644 (file)
@@ -1,3 +1,9 @@
+2005-06-12  Roger Sayle  <roger@eyesopen.com>
+
+       PR c++/21930
+       * error.c (dump_expr): UNARY_PLUS_EXPR need not handle void types.
+       Treat CONVERT_EXPR identically to NOP_EXPR.
+
 2005-06-10  Aldy Hernandez  <aldyh@redhat.com>
 
        PR c++/10611
index 71b7173..c897b64 100644 (file)
@@ -1512,15 +1512,7 @@ dump_expr (tree t, int flags)
       break;
 
     case UNARY_PLUS_EXPR:
-      if (TREE_TYPE (t) && VOID_TYPE_P (TREE_TYPE (t)))
-       {
-         pp_cxx_left_paren (cxx_pp);
-         dump_type (TREE_TYPE (t), flags);
-         pp_cxx_right_paren (cxx_pp);
-         dump_expr (TREE_OPERAND (t, 0), flags);
-       }
-      else
-       dump_unary_op ("+", t, flags);
+      dump_unary_op ("+", t, flags);
       break;
 
     case ADDR_EXPR:
@@ -1600,6 +1592,7 @@ dump_expr (tree t, int flags)
       break;
 
     case NOP_EXPR:
+    case CONVERT_EXPR:
       {
        tree op = TREE_OPERAND (t, 0);
        
index 7278d61..9ae809b 100644 (file)
@@ -1,3 +1,8 @@
+2005-06-12  Roger Sayle  <roger@eyesopen.com>
+
+       PR c++/21930
+       * g++.dg/other/error10.C: New test case.
+
 2005-06-12  Francois-Xavier Coudert  <coudert@clipper.ens.fr>
 
        PR libfortran/19155
diff --git a/gcc/testsuite/g++.dg/other/error10.C b/gcc/testsuite/g++.dg/other/error10.C
new file mode 100644 (file)
index 0000000..d802580
--- /dev/null
@@ -0,0 +1,15 @@
+// PR c++/21930
+// Test case by Volker Reichelt
+// { dg-do compile }
+
+template<int> struct A {};
+
+template<int N>
+void foo(const A<N> &a)
+{ -A<N>(a); } // { dg-error "\\(\\(const A<0>\\*\\)a\\)" "" }
+
+void bar()
+{
+    foo(A<0>()); // { dg-error "instantiated from here" "" }
+}
+