public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jason Merrill <jason@redhat.com>
To: Marek Polacek <polacek@redhat.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] c++: Fix ICE with ill-formed array list-initialization [PR93712]
Date: Thu, 20 Feb 2020 00:28:00 -0000	[thread overview]
Message-ID: <3f199aeb-5033-8fbd-3565-3866d98414b9@redhat.com> (raw)
In-Reply-To: <20200219183009.GB3559@redhat.com>

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	other threads:[~2020-02-20  0:28 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-13 19:56 Marek Polacek
2020-02-14  8:13 ` Jason Merrill
2020-02-19 18:30   ` Marek Polacek
2020-02-20  0:28     ` Jason Merrill [this message]
2020-02-21 23:49       ` [PATCH v2] " Marek Polacek
2020-02-24 14:54         ` Jason Merrill

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3f199aeb-5033-8fbd-3565-3866d98414b9@redhat.com \
    --to=jason@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=polacek@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).