C++ Logo

std-discussion

Advanced search

Re: std::launder question

From: language.lawyer_at <language.lawyer_at_[hidden]>
Date: Tue, 22 Feb 2022 12:05:12 +0300
On 22/02/2022 09:56, Ville Voutilainen via Std-Discussion wrote:
> On Tue, 22 Feb 2022 at 08:37, Peter C++ via Std-Discussion
> <std-discussion_at_[hidden]> wrote:
>>
>> it seems to me using an index 5 on an array of size 5 is at least UB anyway.
>
> The example code doesn't do that.

Well, it says `malloc(sizeof(foo)*20)`, and if sizeof(foo) is 1 and sizeof(T) is 4, it does ;)

Received on 2022-02-22 09:05:16