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]

Re: [PR c++/78469] default ctor makes dtor required


On 01/24/2017 09:13 AM, Nathan Sidwell wrote:
On 01/23/2017 05:01 PM, Jason Merrill wrote:

I suppose adding a tsubst flag isn't too horrible.  But then we also
need to audit other uses of build_value_init to decide whether they
should build a cleanup or not.

@@ -8055,7 +8055,8 @@ build_over_call (struct z_candidate *can
       else if (default_ctor_p (fn))
 	{
 	  if (is_dummy_object (argarray[0]))
-	    return force_target_expr (DECL_CONTEXT (fn), void_node, complain);
+	    return force_target_expr (DECL_CONTEXT (fn), void_node,
+				      complain | tf_no_cleanup);

This is the wrong place for this; we don't know at this point whether we're in a new-expression or actually creating a temporary. I think we want to add this flag in the call to build_value_init from build_new_1. And look at other calls to build_value_init to see if they want it as well.

Jason


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