Update allocator API for C++17
Categories
(Core :: Memory Allocator, task)
Tracking
()
People
(Reporter: rkraesig, Unassigned)
References
Details
C++17 makes a number of changes to operator new to allow for support of over-aligned types.
In particular:
-
C++17 defines a new non-
#defineable macro__STDCPP_DEFAULT_NEW_ALIGNMENT__, which is the minimum guaranteed alignment of the return value ofnew char(). -
New variants of the global
::operator neware defined which take astd::align_val_tto specify the alignment required by the type. These are automatically selected as the implementation ofnew T()whenThas an alignment requirement greater than__STDCPP_DEFAULT_NEW_ALIGNMENT__.
We should make sure that we're consonant with the former (which may involve changing it via --faligned-new=), and that we provide/override the latter.
| Reporter | ||
Comment 1•3 years ago
|
||
Addendum: the current state of affairs is that we disable all of the above, per bug 1560666:
# Likewise for C++17 and aligned allocation. It's not immediately obvious
# from the clang and GCC documentation, but they both support this.
check_and_add_flag("-fno-aligned-new", compiler=cxx_compiler)
I suppose I'm requesting revisiting this decision. This isn't urgent, and I'm not aware of anything it blocks; it would just be nice to not have to care about this particular bit of trivia.
Description
•