[C++ PATCH] PR c++/35878

Jason Merrill jason@redhat.com
Mon Mar 20 23:45:00 GMT 2017


On Mon, Mar 20, 2017 at 7:41 PM, Marc Glisse <marc.glisse@inria.fr> wrote:
> On Tue, 21 Mar 2017, Ville Voutilainen wrote:
>
>> On 20 March 2017 at 04:27, Jason Merrill <jason@redhat.com> wrote:
>>> On Sun, Mar 19, 2017 at 6:19 PM, Ville Voutilainen
>>> <ville.voutilainen@gmail.com> wrote:
>>>> I ran the tests for g++.dg/init thus far. Does this patch make sense?
>>>
>>> The condition needs to be a lot more specific: DR 1748 only applies to
>>> the non-allocating forms in [new.delete.placement], not to other
>>> placement allocation functions.
>>
>> Round 2:
>>
>> The new tests tested on Linux-x64, finishing testing with the full suite on
>> Linux-PPC64.
>>
>> 2017-03-20  Ville Voutilainen  <ville.voutilainen@gmail.com>
>>
>>    gcc/
>>    PR c++/35878
>>    * cp/init.c (build_new_1): Don't do a null check for
>>    a namespace-scope non-replaceable placement new
>>    in C++17 mode unless -fcheck-new is provided.
>
> It looks strange to me. Why not change the definition of check_new instead
> of changing the condition that uses it?

Agreed.  Also, let's factor the new tests out into a function, say
non_allocating_fn_p.

> In C++17 mode, you test for NULL return from throwing operator
> new, why? This is a DR, doesn't it mean that it should apply to all modes?
> Or is the hope that limiting it to an experimental mode might let it pass in
> stage 4?

Bingo.

Jason



More information about the Gcc-patches mailing list