On 2/19/20 7:30 PM, Marek Polacek wrote:
On Fri, Feb 14, 2020 at 09:12:58AM +0100, Jason Merrill wrote:
On 2/13/20 8:56 PM, Marek Polacek wrote:
My P0388R4 patch changed build_array_conv to create an identity
conversion at the start of the conversion chain.

Hmm, an identity conversion of {} suggests that it has a type, which it
doesn't in the language.  I'm not strongly against it, but what was the
reason for this change?

There are two reasons:
1) without it we couldn't get to the original expression at the start
of the conversion chain (saved in .u.expr), this is needed in compare_ics:
10660           tree n1 = nelts_initialized_by_list_init (t1);
10661           tree n2 = nelts_initialized_by_list_init (t2);
and nelts_initialized_by_list_init uses conv_get_original_expr for
arrays that have no dimensions.

Ah, ck_aggr and ck_list probably should have used u.expr like ck_identity and ck_ambig....

2) struct conversion says
/* An implicit conversion sequence, in the sense of [over.best.ics].
    The first conversion to be performed is at the end of the chain.
    That conversion is always a cr_identity conversion.  */
and we were breaking that promise.

...or, if we're going to enforce this, ck_ambig will need to change as well.

And build_aggr_conv and build_complex_conv will need adjusting (one way or another).

Jason

Reply via email to