This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
C++ PATCH: Fix C++/10864
- From: Gabriel Dos Reis <gdr at integrable-solutions dot net>
- To: gcc-patches at gcc dot gnu dot org
- Date: 21 Jun 2003 18:47:01 +0200
- Subject: C++ PATCH: Fix C++/10864
- Organization: Integrable Solutions
This fixes PR C++/10864.
Regtested on an i686-pc-linux-gnu. No regression.
Applied to branch and mainline.
-- Gaby
Index: ChangeLog
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/ChangeLog,v
retrieving revision 1.3076.2.158
diff -p -r1.3076.2.158 ChangeLog
*** ChangeLog 21 Jun 2003 12:56:05 -0000 1.3076.2.158
--- ChangeLog 21 Jun 2003 16:32:47 -0000
***************
*** 1,3 ****
--- 1,10 ----
+ 2003-06-21 Gabriel Dos Reis <gdr@integrable-solutions.net>
+
+ PC c++/10864
+ * call.c (op_error): Tidy.
+ * error.c (dump_expr): Properly format 'T()' when T is an
+ aggregate type.
+
2003-06-21 Gabriel Dos Reis <gdr@integrable-solutions.net>
PR c++/10915
Index: call.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/call.c,v
retrieving revision 1.341.2.21
diff -p -r1.341.2.21 call.c
*** call.c 20 Jun 2003 01:18:43 -0000 1.341.2.21
--- call.c 21 Jun 2003 16:32:50 -0000
*************** op_error (code, code2, arg1, arg2, arg3,
*** 3062,3084 ****
switch (code)
{
case COND_EXPR:
! error ("%s for `%T ? %T : %T' operator", problem,
! error_type (arg1), error_type (arg2), error_type (arg3));
break;
case POSTINCREMENT_EXPR:
case POSTDECREMENT_EXPR:
! error ("%s for `%T %s' operator", problem, error_type (arg1), opname);
break;
case ARRAY_REF:
! error ("%s for `%T [%T]' operator", problem,
! error_type (arg1), error_type (arg2));
break;
default:
if (arg2)
! error ("%s for `%T %s %T' operator", problem,
! error_type (arg1), opname, error_type (arg2));
else
! error ("%s for `%s %T' operator", problem, opname, error_type (arg1));
}
}
--- 3062,3088 ----
switch (code)
{
case COND_EXPR:
! error ("%s for ternary 'operator?:' in '%E ? %E : %E'",
! problem, arg1, arg2, arg3);
break;
+
case POSTINCREMENT_EXPR:
case POSTDECREMENT_EXPR:
! error ("%s for 'operator%s' in '%E%s'", problem, opname, arg1, opname);
break;
+
case ARRAY_REF:
! error ("%s for 'operator[]' in '%E[%E]'", problem, arg1, arg2);
break;
+
default:
if (arg2)
! error ("%s for 'operator%s' in '%E %s %E'",
! problem, opname, arg1, opname, arg2);
else
! error ("%s for 'operator%s' in '%s%E'",
! problem, opname, opname, arg1);
! break;
}
}
Index: error.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/error.c,v
retrieving revision 1.192.2.4
diff -p -r1.192.2.4 error.c
*** error.c 29 Apr 2003 20:15:34 -0000 1.192.2.4
--- error.c 21 Jun 2003 16:32:51 -0000
*************** dump_expr (t, flags)
*** 1899,1907 ****
}
}
}
! output_add_character (scratch_buffer, '{');
! dump_expr_list (CONSTRUCTOR_ELTS (t), flags);
! output_add_character (scratch_buffer, '}');
break;
case OFFSET_REF:
--- 1899,1917 ----
}
}
}
! /* We've gotten an rvalue of the form 'T()'. */
! else if (TREE_TYPE (t))
! {
! dump_type (TREE_TYPE (t), flags);
! print_left_paren (scratch_buffer);
! print_right_paren (scratch_buffer);
! }
! else
! {
! output_add_character (scratch_buffer, '{');
! dump_expr_list (CONSTRUCTOR_ELTS (t), flags);
! output_add_character (scratch_buffer, '}');
! }
break;
case OFFSET_REF: