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: C++ PATCH for c++/65554 (ICE with user-defined initializer_list)


On Wed, Apr 1, 2015 at 3:08 AM, Marek Polacek <polacek@redhat.com> wrote:
> On Tue, Mar 31, 2015 at 03:11:24PM -0400, Jason Merrill wrote:
>> On 03/31/2015 01:22 PM, Marek Polacek wrote:
>> >The user *should* have been using <initializer_list>.  But responding to this
>> >with an ICE isn't acceptable either.
>> >
>> >We do reject wholly incompatible user-defined initializer_list: finish_struct
>> >requires it be a template with a pointer field followed by an integer field,
>> >and in this case it is, but convert_like_real assumes that the second integer
>> >field has a size_type, so it initializes the length with that type.  But as the
>> >following testcase (which clang accepts) shows, it might be a different integer
>> >type, and gimplifier doesn't like any non-trivial conversion in an assignment.
>>
>> I think I'd prefer to enforce that the second integer is size_t, not just an
>> integer, so that the assumption in convert_like_real is correct.
>
> Ok, that isn't hard to do either.
>
> Bootstrapped/regtested on x86_64-linux, ok for trunk?
>
> 2015-04-01  Marek Polacek  <polacek@redhat.com>
>
>         PR c++/65554
>         * class.c (finish_struct): Require that the second field of a
>         user-defined initializer_list be of size type.
>
>         * g++.dg/cpp0x/initlist93.C: New test.
>         * g++.dg/cpp0x/initlist94.C: New test.
>

This caused:

FAIL: g++.dg/cpp0x/pr57101.C  -std=gnu++11 (test for excess errors)
FAIL: g++.dg/cpp0x/pr57101.C  -std=gnu++14 (test for excess errors)

on 32 bit system.

-- 
H.J.


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