C++ Logo

std-proposals

Advanced search

Re: [std-proposals] std::elide

From: Jason McKesson <jmckesson_at_[hidden]>
Date: Sun, 19 May 2024 11:33:40 -0400
On Sun, May 19, 2024 at 7:42 AM Frederick Virchanza Gotham via
Std-Proposals <std-proposals_at_[hidden]> wrote:
> On Saturday, May 18, 2024, Jason McKesson wrote:
>>
>>
>> In the context of an actual proposal for standard C++, there is no
>> "spectrum". There is "allowed by the rules of the standard" or "not
>> allowed". There may be some fuzzy lines where the language of the
>> standard is unclear, but this is not one of those cases.
>>
>> The thing you want to do is "not allowed". Whether you can get away
>> with it on some implementation is relevant only to the question of
>> what it might take for future implementations to implement such
>> functionality should it become "allowed by the rules of the standard"
>
>
>
> I've been following the development of the paper to give us NRVO, and it's become quite complicated:
>
> https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/p2025r1.html
>
> At least one compiler has a bug about destroying the return object when an exception is thrown.
>
> If that paper is just too much hassle to write into the Standard, then the 2nd best option is to use the "placement new" trick I described a post or two ago. Yeah I know it's UB,

Then you haven't actually fixed the problem, have you? If you believe
that the standard needs a way to do NRVO, then providing a "way to do
NRVO" that doesn't represent legal C++ code is not actually fixing the
problem.

Received on 2024-05-19 15:33:52