This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
nw_expr in dump_expr
- To: egcs-patches at cygnus dot com
- Subject: nw_expr in dump_expr
- From: Martin von Loewis <martin at mira dot isdn dot cs dot tu-berlin dot de>
- Date: Sat, 30 May 1998 10:44:47 +0200
There are several of Robert's cases where NEW_EXPR appears in
dump_expr. A patch is included below.
There are two problems: I'm not sure how to test this, as I want
dejagnu to look at the specific error message.
Also, for multi-dimensional array, the primary dimension is printed
last.
Martin
1998-05-30 Martin von Löwis <loewis@informatik.hu-berlin.de>
* error.c (dump_expr): Support NEW_EXPR.
Index: error.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/error.c,v
retrieving revision 1.44
diff -c -p -r1.44 error.c
*** error.c 1998/05/26 12:55:05 1.44
--- error.c 1998/05/30 08:39:18
*************** dump_expr (t, nop)
*** 1341,1346 ****
--- 1341,1376 ----
}
break;
+ case NEW_EXPR:
+ {
+ tree type = TREE_OPERAND (t, 1);
+ OB_PUTS ("new ");
+ if (TREE_OPERAND (t, 0))
+ {
+ OB_PUTC ('(');
+ dump_expr_list (TREE_OPERAND (t, 0));
+ OB_PUTS (") ");
+ }
+ if (TREE_CODE (type) == ARRAY_REF)
+ {
+ /* XXX In multi-dimensional array, the dimensions come out
+ in the wrong order. */
+ dump_type (TREE_OPERAND (type, 0), 0);
+ OB_PUTC ('[');
+ dump_expr (TREE_OPERAND (type, 1), 1);
+ OB_PUTC (']');
+ }
+ else
+ dump_type (TREE_OPERAND (t, 1), 0);
+ if (TREE_OPERAND (t,2))
+ {
+ OB_PUTC ('(');
+ dump_expr_list (TREE_OPERAND (t, 2));
+ OB_PUTC (')');
+ }
+ }
+ break;
+
case TARGET_EXPR:
/* Note that this only works for G++ target exprs. If somebody
builds a general TARGET_EXPR, there's no way to represent that
--- /dev/null Mon Jul 18 01:46:18 1994
+++ g++.other/new2.C Sat May 30 10:43:26 1998
@@ -0,0 +1,22 @@
+//Build don't link:
+typedef unsigned int size_t;
+void *operator new(size_t, unsigned int);
+
+struct X{
+ X();
+ X(int);
+};
+
+
+void f(X *x = new X); // ERROR -
+
+void f(X *x = new X(4)); // ERROR -
+
+void f(X *x = new X[4]); // ERROR -
+
+void f(X *x = new (3) X(6)); // ERROR -
+
+void f(X *x = new (2) X[10]); // ERROR -
+
+void f(X *x = new X[10][5]); // ERROR -
+