C++ PATCH for c++/91363 - P0960R3: Parenthesized initialization of aggregates

Jason Merrill jason@redhat.com
Tue Dec 3 07:01:00 GMT 2019


On 12/2/19 7:31 PM, Marek Polacek wrote:
> @@ -1967,8 +1978,23 @@ expand_default_init (tree binfo, tree true_exp, tree exp, tree init, int flags,
>         tree ctor_name = (true_exp == exp
>   			? complete_ctor_identifier : base_ctor_identifier);
>   
> +      /* Given class A,
> +
> +	   A a(1, 2);
> +
> +	 can mean a call to a constructor A::A(int, int), if present.  If not,
> +	 but A is an aggregate, we will try aggregate initialization.  */
>         rval = build_special_member_call (exp, ctor_name, &parms, binfo, flags,
>   					complain);
> +      if (BRACE_ENCLOSED_INITIALIZER_P (rval))
> +	{
> +	  gcc_assert (cxx_dialect >= cxx2a);
> +	  rval = digest_init (type, rval, tf_warning_or_error);
> +	  rval = build2 (INIT_EXPR, type, exp, rval);
> +	  /* So that we do finish_expr_stmt below.  Don't return here, we
> +	     need to release PARMS.  */
> +	  TREE_SIDE_EFFECTS (rval) = 1;
> +	}

Can we still get a CONSTRUCTOR here after the change to 
build_new_method_call_1?

Jason



More information about the Gcc-patches mailing list