With GCC and Clang on x86-64/Linux alignof(std::max_align_t)
and __STDCPP_DEFAULT_NEW_ALIGNMENT__
are both equal to 16
.
With MSVC on x86-64/Windows alignof(std::max_align_t)
is 8
and __STDCPP_DEFAULT_NEW_ALIGNMENT__
is 16
.
The standard defines the two terms corresponding to these quantities in [basic.align]/3:
An extended alignment is represented by an alignment greater than
alignof(std::max_align_t)
. [...] A type having an extended alignment requirement is an over-aligned type. [...] A new-extended alignment is represented by an alignment greater than__STDCPP_DEFAULT_NEW_ALIGNMENT__
.
I don't see that this implies any ordering between the two values, except if I interpret the term "new-extended" to imply "extended" from the spelling.
Is a conforming implementation of the C++ standard allowed to have
alignof(std::max_align_t) > __STDCPP_DEFAULT_NEW_ALIGNMENT__
?
And if it does, does this imply that object creation via
auto x = ::new(::operator new(sizeof(T))) T;
could be undefined behavior for some non-over-aligned type T
?