From mboxrd@z Thu Jan 1 00:00:00 1970 From: "John David Anglin" To: mark@codesourcery.com (Mark Mitchell) Cc: gcc@gcc.gnu.org Subject: Re: GCC 3.0 Status Report Date: Wed, 18 Apr 2001 09:00:00 -0000 Message-id: <200104181600.MAA04908@hiauly1.hia.nrc.ca> References: <20010418005508T.mitchell@codesourcery.com> X-SW-Source: 2001-04/msg00865.html > I think that probably the other part is correct, but can you explain > it in more detail? Not what the problem is (I get that), but why your > fix is the correct approach? I am not entirely certain the approach is correct as my knowledge of C++ and g++ is limited. Can you see another way to copy the result without using build_aggr_init? My approach was based on debugging the existing code. The call_expr is converted by ocp_convert to a tree expression containing another aggr_init_expr in expand_default_init. Here is the code there: if (flags & DIRECT_BIND) /* Do nothing. We hit this in two cases: Reference initialization, where we aren't initializing a real variable, so we don't want to run a new constructor; and catching an exception, where we have already built up the constructor call so we could wrap it in an exception region. */; else if (TREE_CODE (init) == CONSTRUCTOR) /* A brace-enclosed initializer has whatever type is required. There's no need to convert it. */ ; else init = ocp_convert (type, init, CONV_IMPLICIT|CONV_FORCE_TEMP, flags); It looked to me like the call was already built, so adding DIRECT_BIND to the flags was the right thing to do to prevent the conversion. However, maybe the code here should be checking for a CALL_EXPR. There is this comment for build_aggr_init: If INIT resolves to a CALL_EXPR which happens to return something of the type we are looking for, then we know that we can safely use that call to perform the initialization. Dave -- J. David Anglin dave.anglin@nrc.ca National Research Council of Canada (613) 990-0752 (FAX: 952-6605)