using size_t = decltype(sizeof(0));
namespace std { enum class align_val_t : size_t {}; }
struct Arg {} arg;
template<unsigned Align, typename ...Ts>
struct alignas(Align) Unaligned {
void *operator new(size_t, Ts...) = delete; };
auto *ua = new Unaligned<__STDCPP_DEFAULT_NEW_ALIGNMENT__>; auto *ub = new Unaligned<__STDCPP_DEFAULT_NEW_ALIGNMENT__ * 2>; auto *uap = new (arg) Unaligned<__STDCPP_DEFAULT_NEW_ALIGNMENT__, Arg>; auto *ubp = new (arg) Unaligned<__STDCPP_DEFAULT_NEW_ALIGNMENT__ * 2, Arg>;
template<unsigned Align, typename ...Ts>
struct alignas(Align) Aligned {
void *operator new(size_t, std::align_val_t, Ts...) = delete; };
auto *aa = new Aligned<__STDCPP_DEFAULT_NEW_ALIGNMENT__>; auto *ab = new Aligned<__STDCPP_DEFAULT_NEW_ALIGNMENT__ * 2>; auto *aap = new (arg) Aligned<__STDCPP_DEFAULT_NEW_ALIGNMENT__, Arg>; auto *abp = new (arg) Aligned<__STDCPP_DEFAULT_NEW_ALIGNMENT__ * 2, Arg>;
template<unsigned Align, typename ...Ts>
struct alignas(Align) Both1 {
void *operator new(size_t, Ts...); void *operator new(size_t, std::align_val_t, Ts...) = delete; };
template<unsigned Align, typename ...Ts>
struct alignas(Align) Both2 {
void *operator new(size_t, Ts...) = delete; void *operator new(size_t, std::align_val_t, Ts...); };
auto *b1a = new Both1<__STDCPP_DEFAULT_NEW_ALIGNMENT__>;
auto *b1b = new Both1<__STDCPP_DEFAULT_NEW_ALIGNMENT__ * 2>; auto *b2a = new Both2<__STDCPP_DEFAULT_NEW_ALIGNMENT__>; auto *b2b = new Both2<__STDCPP_DEFAULT_NEW_ALIGNMENT__ * 2>;
auto *b1ap = new (arg) Both1<__STDCPP_DEFAULT_NEW_ALIGNMENT__, Arg>;
auto *b1bp = new (arg) Both1<__STDCPP_DEFAULT_NEW_ALIGNMENT__ * 2, Arg>; auto *b2ap = new (arg) Both2<__STDCPP_DEFAULT_NEW_ALIGNMENT__, Arg>; auto *b2bp = new (arg) Both2<__STDCPP_DEFAULT_NEW_ALIGNMENT__ * 2, Arg>;
struct alignas(__STDCPP_DEFAULT_NEW_ALIGNMENT__ * 2) WeirdAlignedAlloc1 {
void *operator new(size_t, ...) = delete; };
auto *waa1 = new WeirdAlignedAlloc1; auto *waa1p = new (arg) WeirdAlignedAlloc1;
struct alignas(__STDCPP_DEFAULT_NEW_ALIGNMENT__ * 2) WeirdAlignedAlloc2 {
template<typename ...T>
void *operator new(size_t, T...) {
using U = void(T...); using U = void; }
};
auto *waa2 = new WeirdAlignedAlloc2; auto *waa2p = new (arg) WeirdAlignedAlloc2;