std::optional defaut constructor

Marc Glisse marc.glisse@inria.fr
Wed Jun 3 23:12:59 GMT 2020


On Thu, 4 Jun 2020, Ville Voutilainen wrote:

> On Thu, 4 Jun 2020 at 01:52, Marc Glisse <marc.glisse@inria.fr> wrote:
>>
>> Hello,
>>
>> is there any drawback to the attached patch? It changes the code generated for
>
> I don't get it. The noexceptness of the defaulted default constructor
> should be a computation
> of the noexceptness of the subobjects, and that should boil down to
> whether optional's storage
> is noexcept-default-constructible. And that thing has a noexcept
> default constructor. Why
> does this patch change anything?

"noexcept" is a red herring, what matters is defaulted vs user-provided. 
In one case, we end up zero-initializing the whole buffer, and not in the 
other.

-- 
Marc Glisse


More information about the Gcc-patches mailing list