This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[3.3] C++ PATCH to build_modify_expr for 11063


In the testcase we have a compound literal initializer for an array member
which doesn't match the type of the member.  Rather than abort, we can try
and fail to convert.

Tested x86_64-pc-linux-gnu, applied to trunk and 3.3.

Test in g++.dg/ext/complit1.C.

2003-10-14  Jason Merrill  <jason@redhat.com>

	PR c++/11063
	* typeck.c (build_modify_expr): Call convert rather than abort.

*** typeck.c.~1~	2003-10-13 18:02:41.000000000 -0400
--- typeck.c	2003-10-14 15:16:58.000000000 -0400
*************** build_modify_expr (lhs, modifycode, rhs)
*** 5298,5305 ****
      {
        if (TREE_CODE (rhs) == CONSTRUCTOR)
  	{
! 	  my_friendly_assert (same_type_p (TREE_TYPE (rhs), lhstype),
! 			      20011220);
  	  result = build (INIT_EXPR, lhstype, lhs, rhs);
  	  TREE_SIDE_EFFECTS (result) = 1;
  	  return result;
--- 5298,5306 ----
      {
        if (TREE_CODE (rhs) == CONSTRUCTOR)
  	{
! 	  if (! same_type_p (TREE_TYPE (rhs), lhstype))
! 	    /* Call convert to generate an error; see PR 11063.  */
! 	    rhs = convert (lhstype, rhs);
  	  result = build (INIT_EXPR, lhstype, lhs, rhs);
  	  TREE_SIDE_EFFECTS (result) = 1;
  	  return result;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]