Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2022-02-18 19:41:28


> The third issue we're having is with our aligned_storage. Its address() member
> function doesn't return the address of the unsigned char[] array, but the
> address of the aligned_storage object itself (or rather, to its
> aligned_storage_impl base, which contains the char array as its first member.
> Inside a union.)
>
> This means that we aren't in the clear with respect to the "provides storage"
> wording in https://eel.is/c++draft/basic.memobj#intro.object-3. I'm not
> entirely sure that what we're doing is undefined, but it looks like we can
> avoid this issue by just returning the address of the char array in address().
>
> Note that this potential source of UB can't be fixed with launder.

https://github.com/boostorg/type_traits/pull/168

As already noted, this doesn't affect Boost.Optional, which has its own
aligned_storage.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk