From 97f00c7cc5b5a9f366856dac3b2a1ca11a48d24d Mon Sep 17 00:00:00 2001 From: Alex Guteniev Date: Sun, 15 Feb 2026 14:46:12 +0200 Subject: [PATCH 01/14] Try `/Zc:alignedNew-` for the latest features --- .../std/tests/GH_005504_avoid_function_call_wrapping/test.cpp | 4 ++++ tests/std/tests/P2502R2_generator/test.cpp | 4 ++++ tests/std/tests/strict_latest_matrix.lst | 2 ++ tests/std/tests/usual_latest_matrix.lst | 2 ++ 4 files changed, 12 insertions(+) diff --git a/tests/std/tests/GH_005504_avoid_function_call_wrapping/test.cpp b/tests/std/tests/GH_005504_avoid_function_call_wrapping/test.cpp index bd3df479759..d25a84834f9 100644 --- a/tests/std/tests/GH_005504_avoid_function_call_wrapping/test.cpp +++ b/tests/std/tests/GH_005504_avoid_function_call_wrapping/test.cpp @@ -38,6 +38,7 @@ void operator delete(void* const mem) noexcept { free(mem); } +#ifdef __cpp_aligned_new void* operator new(const size_t size, const align_val_t al) { ++alloc_count; return check_alloc(_aligned_malloc(adjust_alloc_size(size), static_cast(al))); @@ -47,6 +48,7 @@ void operator delete(void* const mem, align_val_t) noexcept { ++dealloc_count; _aligned_free(mem); } +#endif // ^^^ !defined(__cpp_aligned_new) ^^^ struct alloc_checker { explicit alloc_checker(const int expected_delta_) : expected_delta(expected_delta_) {} @@ -90,7 +92,9 @@ struct alignas(128) large_callable { const int context = 1729; int operator()(const copy_counter& counter) const noexcept { +#ifdef __cpp_aligned_new assert((reinterpret_cast(this) & 0x7f) == 0); +#endif // ^^^ !defined(__cpp_aligned_new) ^^^ assert(context == 1729); return counter.count; } diff --git a/tests/std/tests/P2502R2_generator/test.cpp b/tests/std/tests/P2502R2_generator/test.cpp index a95255cb4e6..d5fb2b247f2 100644 --- a/tests/std/tests/P2502R2_generator/test.cpp +++ b/tests/std/tests/P2502R2_generator/test.cpp @@ -306,9 +306,11 @@ void dynamic_allocator_test() { test_one, int, int&&, int&&>( g(allocator_arg, StatefulAlloc{1729}, 1024), views::iota(0, 1024)); #endif // ^^^ no workaround ^^^ +#ifdef __cpp_aligned_new pmr::synchronized_pool_resource pool; test_one, int, int&&, int&&>( g(allocator_arg, pmr::polymorphic_allocator<>{&pool}, 1024), views::iota(0, 1024)); +#endif // defined(__cpp_aligned_new) } static atomic allow_allocation{true}; @@ -330,6 +332,7 @@ void operator delete(void* const p, size_t) noexcept { free(p); } +#ifdef __cpp_aligned_new void* operator new(const size_t n, const align_val_t al) { if (allow_allocation) { if (void* const result = ::_aligned_malloc(n, static_cast(al))) { @@ -346,6 +349,7 @@ void operator delete(void* const p, align_val_t) noexcept { void operator delete(void* const p, size_t, align_val_t) noexcept { ::_aligned_free(p); } +#endif // ^^^ !defined(__cpp_aligned_new) ^^^ class malloc_resource final : public pmr::memory_resource { private: diff --git a/tests/std/tests/strict_latest_matrix.lst b/tests/std/tests/strict_latest_matrix.lst index b67794f67cb..dd220035914 100644 --- a/tests/std/tests/strict_latest_matrix.lst +++ b/tests/std/tests/strict_latest_matrix.lst @@ -15,6 +15,8 @@ PM_CL="/MD /D_ITERATOR_DEBUG_LEVEL=0 /Zc:char8_t- /Zc:preprocessor" ASAN PM_CL="/MD /Zc:char8_t- /Zc:preprocessor -fsanitize=address /Zi" PM_LINK="/debug" PM_CL="/MDd /D_ITERATOR_DEBUG_LEVEL=0 /Zc:wchar_t-" ASAN PM_CL="/MDd /Zc:wchar_t- -fsanitize=address /Zi" PM_LINK="/debug" +PM_CL="/MD /D_ITERATOR_DEBUG_LEVEL=0 /permissive- /Zc:alignedNew-" +ASAN PM_CL="/MD /permissive- /Zc:alignedNew- -fsanitize=address /Zi" PM_LINK="/debug" PM_CL="/MDd /D_ITERATOR_DEBUG_LEVEL=1" ASAN PM_CL="/MDd -fsanitize=address /Zi" PM_LINK="/debug" PM_CL="/MDd /D_ITERATOR_DEBUG_LEVEL=2 /fp:except /Zc:preprocessor" diff --git a/tests/std/tests/usual_latest_matrix.lst b/tests/std/tests/usual_latest_matrix.lst index 1e3d4da8cd9..859a515c1eb 100644 --- a/tests/std/tests/usual_latest_matrix.lst +++ b/tests/std/tests/usual_latest_matrix.lst @@ -11,6 +11,8 @@ PM_CL="/MD /D_ITERATOR_DEBUG_LEVEL=1 /permissive-" ASAN PM_CL="/MD /permissive- -fsanitize=address /Zi" PM_LINK="/debug" PM_CL="/MD /D_ITERATOR_DEBUG_LEVEL=0 /permissive- /Zc:char8_t-" ASAN PM_CL="/MD /permissive- /Zc:char8_t- -fsanitize=address /Zi" PM_LINK="/debug" +PM_CL="/MD /D_ITERATOR_DEBUG_LEVEL=0 /permissive- /Zc:alignedNew-" +ASAN PM_CL="/MD /permissive- /Zc:alignedNew- -fsanitize=address /Zi" PM_LINK="/debug" PM_CL="/MDd /D_ITERATOR_DEBUG_LEVEL=0 /permissive- /Zc:wchar_t- /Zc:preprocessor" ASAN PM_CL="/MDd /permissive- /Zc:wchar_t- /Zc:preprocessor -fsanitize=address /Zi" PM_LINK="/debug" PM_CL="/MDd /D_ITERATOR_DEBUG_LEVEL=1 /permissive-" From dd160bbda1ea8454f802bcb6681d36193592721f Mon Sep 17 00:00:00 2001 From: Alex Guteniev Date: Sun, 15 Feb 2026 15:43:25 +0200 Subject: [PATCH 02/14] correct preprocessor comments --- .../std/tests/GH_005504_avoid_function_call_wrapping/test.cpp | 4 ++-- tests/std/tests/P2502R2_generator/test.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/std/tests/GH_005504_avoid_function_call_wrapping/test.cpp b/tests/std/tests/GH_005504_avoid_function_call_wrapping/test.cpp index d25a84834f9..1d8c12648b4 100644 --- a/tests/std/tests/GH_005504_avoid_function_call_wrapping/test.cpp +++ b/tests/std/tests/GH_005504_avoid_function_call_wrapping/test.cpp @@ -48,7 +48,7 @@ void operator delete(void* const mem, align_val_t) noexcept { ++dealloc_count; _aligned_free(mem); } -#endif // ^^^ !defined(__cpp_aligned_new) ^^^ +#endif // ^^^ defined(__cpp_aligned_new) ^^^ struct alloc_checker { explicit alloc_checker(const int expected_delta_) : expected_delta(expected_delta_) {} @@ -94,7 +94,7 @@ struct alignas(128) large_callable { int operator()(const copy_counter& counter) const noexcept { #ifdef __cpp_aligned_new assert((reinterpret_cast(this) & 0x7f) == 0); -#endif // ^^^ !defined(__cpp_aligned_new) ^^^ +#endif // ^^^ defined(__cpp_aligned_new) ^^^ assert(context == 1729); return counter.count; } diff --git a/tests/std/tests/P2502R2_generator/test.cpp b/tests/std/tests/P2502R2_generator/test.cpp index d5fb2b247f2..0d525a80493 100644 --- a/tests/std/tests/P2502R2_generator/test.cpp +++ b/tests/std/tests/P2502R2_generator/test.cpp @@ -310,7 +310,7 @@ void dynamic_allocator_test() { pmr::synchronized_pool_resource pool; test_one, int, int&&, int&&>( g(allocator_arg, pmr::polymorphic_allocator<>{&pool}, 1024), views::iota(0, 1024)); -#endif // defined(__cpp_aligned_new) +#endif // ^^^ defined(__cpp_aligned_new) ^^^ } static atomic allow_allocation{true}; @@ -349,7 +349,7 @@ void operator delete(void* const p, align_val_t) noexcept { void operator delete(void* const p, size_t, align_val_t) noexcept { ::_aligned_free(p); } -#endif // ^^^ !defined(__cpp_aligned_new) ^^^ +#endif // ^^^ defined(__cpp_aligned_new) ^^^ class malloc_resource final : public pmr::memory_resource { private: From 709c41aa71db4be5a275a0d63a5ef4fbfa736101 Mon Sep 17 00:00:00 2001 From: Alex Guteniev Date: Sun, 15 Feb 2026 17:02:03 +0200 Subject: [PATCH 03/14] Burn more fuel! --- tests/std/include/new_counter.hpp | 2 ++ tests/std/include/test_header_units_and_modules.hpp | 2 ++ .../P1020R1_smart_pointer_for_overwrite/test.cpp | 12 ++++++++++++ tests/std/tests/P2502R2_generator/test.cpp | 4 ++-- tests/std/tests/strict_20_matrix.lst | 2 ++ tests/std/tests/usual_20_matrix.lst | 2 ++ 6 files changed, 22 insertions(+), 2 deletions(-) diff --git a/tests/std/include/new_counter.hpp b/tests/std/include/new_counter.hpp index 2954dfd7d9a..fc3846f7bae 100644 --- a/tests/std/include/new_counter.hpp +++ b/tests/std/include/new_counter.hpp @@ -33,6 +33,7 @@ void* operator new(size_t size) { return p; } +#ifdef __cpp_aligned_new void* operator new(size_t, std::align_val_t) { abort(); } @@ -117,5 +118,6 @@ void operator delete[](void* ptr, const std::nothrow_t&) noexcept { void operator delete[](void*, std::align_val_t, const std::nothrow_t&) noexcept { abort(); } +#endif // ^^^ defined(__cpp_aligned_new) ^^^ #pragma warning(pop) diff --git a/tests/std/include/test_header_units_and_modules.hpp b/tests/std/include/test_header_units_and_modules.hpp index 71aaf6a6632..8115b163da2 100644 --- a/tests/std/include/test_header_units_and_modules.hpp +++ b/tests/std/include/test_header_units_and_modules.hpp @@ -542,7 +542,9 @@ void test_new() { static_assert(is_class_v); static_assert(is_class_v); +#ifdef __cpp_aligned_new static_assert(is_same_v, size_t>); +#endif // ^^^ defined(__cpp_aligned_new) ^^^ static_assert(is_class_v); bool caught_bad_alloc = false; diff --git a/tests/std/tests/P1020R1_smart_pointer_for_overwrite/test.cpp b/tests/std/tests/P1020R1_smart_pointer_for_overwrite/test.cpp index 39371d080e4..0150ccff944 100644 --- a/tests/std/tests/P1020R1_smart_pointer_for_overwrite/test.cpp +++ b/tests/std/tests/P1020R1_smart_pointer_for_overwrite/test.cpp @@ -47,6 +47,7 @@ void* operator new(size_t size, const nothrow_t&) noexcept { return result; } +#ifdef __cpp_aligned_new void* operator new(size_t size, align_val_t align) { void* const p = ::operator new(size, align, nothrow); @@ -66,6 +67,7 @@ void* operator new(size_t size, align_val_t align, const nothrow_t&) noexcept { return result; } +#endif // ^^^ defined(__cpp_aligned_new) ^^^ template struct unique_is_for_overwritable : false_type {}; @@ -188,7 +190,9 @@ void test_make_shared_for_overwrite() { assert(p1->value == initializedValue); auto p2 = make_shared_for_overwrite_assert(); +#ifdef __cpp_aligned_new assert(reinterpret_cast(p2.get()) % alignof(HighlyAligned) == 0); +#endif // ^^^ defined(__cpp_aligned_new) ^^^ assert_uninitialized(addressof(*p2), sizeof(HighlyAligned)); auto p3 = make_shared_for_overwrite_assert(); @@ -202,7 +206,9 @@ void test_make_shared_for_overwrite() { } auto p5 = make_shared_for_overwrite_assert(); +#ifdef __cpp_aligned_new assert(reinterpret_cast(p5.get()) % alignof(HighlyAligned) == 0); +#endif // ^^^ defined(__cpp_aligned_new) ^^^ assert_uninitialized(addressof(p5[0]), sizeof(HighlyAligned) * 10u); auto p6 = make_shared_for_overwrite_assert(100u); @@ -225,7 +231,9 @@ void test_make_shared_for_overwrite() { auto p9 = make_shared_for_overwrite_assert(0u); // p9 cannot be dereferenced auto p10 = make_shared_for_overwrite_assert(10u); +#ifdef __cpp_aligned_new assert(reinterpret_cast(p10.get()) % alignof(HighlyAligned) == 0); +#endif // ^^^ defined(__cpp_aligned_new) ^^^ assert_uninitialized(addressof(p10[0]), sizeof(HighlyAligned) * 10u); test_make_shared_init_destruct_order(); // success one dimensional @@ -294,7 +302,9 @@ void test_allocate_shared_for_overwrite() { } auto p5 = allocate_shared_for_overwrite_assert(a2); +#ifdef __cpp_aligned_new assert(reinterpret_cast(p5.get()) % alignof(HighlyAligned) == 0); +#endif // ^^^ defined(__cpp_aligned_new) ^^^ assert_uninitialized(addressof(p5[0]), sizeof(HighlyAligned) * 10u); auto p6 = allocate_shared_for_overwrite_assert(a1, 100u); @@ -317,7 +327,9 @@ void test_allocate_shared_for_overwrite() { auto p9 = allocate_shared_for_overwrite_assert(a0, 0u); // p9 cannot be dereferenced auto p10 = allocate_shared_for_overwrite_assert(a2, 10u); +#ifdef __cpp_aligned_new assert(reinterpret_cast(p10.get()) % alignof(HighlyAligned) == 0); +#endif // ^^^ defined(__cpp_aligned_new) ^^^ assert_uninitialized(addressof(p10[0]), sizeof(HighlyAligned) * 10u); test_allocate_shared_init_destruct_order(); // success one dimensional diff --git a/tests/std/tests/P2502R2_generator/test.cpp b/tests/std/tests/P2502R2_generator/test.cpp index 0d525a80493..72e9552b7a1 100644 --- a/tests/std/tests/P2502R2_generator/test.cpp +++ b/tests/std/tests/P2502R2_generator/test.cpp @@ -306,11 +306,11 @@ void dynamic_allocator_test() { test_one, int, int&&, int&&>( g(allocator_arg, StatefulAlloc{1729}, 1024), views::iota(0, 1024)); #endif // ^^^ no workaround ^^^ -#ifdef __cpp_aligned_new +// #ifdef __cpp_aligned_new pmr::synchronized_pool_resource pool; test_one, int, int&&, int&&>( g(allocator_arg, pmr::polymorphic_allocator<>{&pool}, 1024), views::iota(0, 1024)); -#endif // ^^^ defined(__cpp_aligned_new) ^^^ +// #endif // ^^^ defined(__cpp_aligned_new) ^^^ } static atomic allow_allocation{true}; diff --git a/tests/std/tests/strict_20_matrix.lst b/tests/std/tests/strict_20_matrix.lst index c4ea4e65407..be35061a87d 100644 --- a/tests/std/tests/strict_20_matrix.lst +++ b/tests/std/tests/strict_20_matrix.lst @@ -7,6 +7,8 @@ RUNALL_INCLUDE .\prefix.lst RUNALL_CROSSLIST * PM_CL="/w14640 /Zc:threadSafeInit- /permissive-" RUNALL_CROSSLIST +PM_CL="/EHsc /MD /D_ITERATOR_DEBUG_LEVEL=0 /std:c++latest /permissive- /Zc:alignedNew- /wd4316" +ASAN PM_CL="/EHsc /MD /std:c++latest /permissive- /Zc:alignedNew- /wd4316 -fsanitize=address /Zi" PM_LINK="/debug" PM_CL="/EHsc /MD /D_ITERATOR_DEBUG_LEVEL=0 /std:c++20 /Zc:noexceptTypes-" ASAN PM_CL="/EHsc /MD /std:c++20 /Zc:noexceptTypes- -fsanitize=address /Zi" PM_LINK="/debug" PM_CL="/EHsc /MD /D_ITERATOR_DEBUG_LEVEL=1 /std:c++latest" diff --git a/tests/std/tests/usual_20_matrix.lst b/tests/std/tests/usual_20_matrix.lst index 8964140309b..414110511ff 100644 --- a/tests/std/tests/usual_20_matrix.lst +++ b/tests/std/tests/usual_20_matrix.lst @@ -5,6 +5,8 @@ RUNALL_INCLUDE .\prefix.lst RUNALL_CROSSLIST * PM_CL="/w14640 /Zc:threadSafeInit-" RUNALL_CROSSLIST +PM_CL="/EHsc /MD /D_ITERATOR_DEBUG_LEVEL=0 /std:c++latest /permissive- /Zc:alignedNew- /wd4316" +ASAN PM_CL="/EHsc /MD /std:c++latest /permissive- /Zc:alignedNew- /wd4316 -fsanitize=address /Zi" PM_LINK="/debug" PM_CL="/EHsc /MD /D_ITERATOR_DEBUG_LEVEL=0 /std:c++20 /permissive- /Zc:noexceptTypes-" ASAN PM_CL="/EHsc /MD /std:c++20 /permissive- /Zc:noexceptTypes- -fsanitize=address /Zi" PM_LINK="/debug" PM_CL="/EHsc /MD /D_ITERATOR_DEBUG_LEVEL=1 /std:c++latest /permissive-" From a51be14d236435bdef7827ff3ecd5f05f72775e4 Mon Sep 17 00:00:00 2001 From: Alex Guteniev Date: Sun, 15 Feb 2026 17:12:12 +0200 Subject: [PATCH 04/14] That was no intention! --- tests/std/tests/P2502R2_generator/test.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/std/tests/P2502R2_generator/test.cpp b/tests/std/tests/P2502R2_generator/test.cpp index 72e9552b7a1..0d525a80493 100644 --- a/tests/std/tests/P2502R2_generator/test.cpp +++ b/tests/std/tests/P2502R2_generator/test.cpp @@ -306,11 +306,11 @@ void dynamic_allocator_test() { test_one, int, int&&, int&&>( g(allocator_arg, StatefulAlloc{1729}, 1024), views::iota(0, 1024)); #endif // ^^^ no workaround ^^^ -// #ifdef __cpp_aligned_new +#ifdef __cpp_aligned_new pmr::synchronized_pool_resource pool; test_one, int, int&&, int&&>( g(allocator_arg, pmr::polymorphic_allocator<>{&pool}, 1024), views::iota(0, 1024)); -// #endif // ^^^ defined(__cpp_aligned_new) ^^^ +#endif // ^^^ defined(__cpp_aligned_new) ^^^ } static atomic allow_allocation{true}; From 8a38ea00a8809e2ce96013eb4926c3894b7b5109 Mon Sep 17 00:00:00 2001 From: Alex Guteniev Date: Sun, 15 Feb 2026 17:34:07 +0200 Subject: [PATCH 05/14] fix test --- tests/std/include/new_counter.hpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/std/include/new_counter.hpp b/tests/std/include/new_counter.hpp index fc3846f7bae..2bcd0429041 100644 --- a/tests/std/include/new_counter.hpp +++ b/tests/std/include/new_counter.hpp @@ -37,6 +37,7 @@ void* operator new(size_t size) { void* operator new(size_t, std::align_val_t) { abort(); } +#endif // ^^^ defined(__cpp_aligned_new) ^^^ void* operator new(size_t size, const std::nothrow_t&) noexcept { if (std_testing::g_total_news == std_testing::g_maximum_news) { @@ -51,9 +52,11 @@ void* operator new(size_t size, const std::nothrow_t&) noexcept { return malloc(size); } +#ifdef __cpp_aligned_new void* operator new(size_t, std::align_val_t, const std::nothrow_t&) noexcept { abort(); } +#endif // ^^^ defined(__cpp_aligned_new) ^^^ void operator delete(void* ptr) noexcept { ::operator delete(ptr, std::nothrow); @@ -63,9 +66,11 @@ void operator delete(void* ptr, size_t) noexcept { ::operator delete(ptr, std::nothrow); } +#ifdef __cpp_aligned_new void operator delete(void*, std::align_val_t) noexcept { abort(); } +#endif // ^^^ defined(__cpp_aligned_new) ^^^ void operator delete(void* ptr, const std::nothrow_t&) noexcept { if (ptr) { @@ -75,25 +80,31 @@ void operator delete(void* ptr, const std::nothrow_t&) noexcept { } } +#ifdef __cpp_aligned_new void operator delete(void*, std::align_val_t, const std::nothrow_t&) noexcept { abort(); } +#endif // ^^^ defined(__cpp_aligned_new) ^^^ void* operator new[](size_t size) { return ::operator new(size); } +#ifdef __cpp_aligned_new void* operator new[](size_t, std::align_val_t) { abort(); } +#endif // ^^^ defined(__cpp_aligned_new) ^^^ void* operator new[](size_t size, const std::nothrow_t&) noexcept { return ::operator new(size, std::nothrow); } +#ifdef __cpp_aligned_new void* operator new[](size_t, std::align_val_t, const std::nothrow_t&) noexcept { abort(); } +#endif // ^^^ defined(__cpp_aligned_new) ^^^ void operator delete[](void* ptr) noexcept { ::operator delete(ptr); @@ -103,6 +114,7 @@ void operator delete[](void* ptr, size_t size) noexcept { ::operator delete(ptr, size); } +#ifdef __cpp_aligned_new void operator delete[](void*, std::align_val_t) noexcept { abort(); } @@ -110,11 +122,13 @@ void operator delete[](void*, std::align_val_t) noexcept { void operator delete[](void*, size_t, std::align_val_t) noexcept { abort(); } +#endif // ^^^ defined(__cpp_aligned_new) ^^^ void operator delete[](void* ptr, const std::nothrow_t&) noexcept { ::operator delete(ptr, std::nothrow); } +#ifdef __cpp_aligned_new void operator delete[](void*, std::align_val_t, const std::nothrow_t&) noexcept { abort(); } From 3240ff94e3b85d13bdfa043eb8badd8db4eb1494 Mon Sep 17 00:00:00 2001 From: Alex Guteniev Date: Sun, 15 Feb 2026 17:38:31 +0200 Subject: [PATCH 06/14] fix P0674R1_make_shared_for_arrays --- .../tests/P0674R1_make_shared_for_arrays/test.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/std/tests/P0674R1_make_shared_for_arrays/test.cpp b/tests/std/tests/P0674R1_make_shared_for_arrays/test.cpp index ae408c850b8..274f4db81f7 100644 --- a/tests/std/tests/P0674R1_make_shared_for_arrays/test.cpp +++ b/tests/std/tests/P0674R1_make_shared_for_arrays/test.cpp @@ -156,7 +156,9 @@ void test_make_shared_not_array() { shared_ptr p5 = make_shared(); assert_shared_use_get(p5); +#ifdef __cpp_aligned_new assert(reinterpret_cast(p5.get()) % alignof(HighlyAligned) == 0); +#endif // ^^^ defined(__cpp_aligned_new) ^^^ assert(p5->a == 0 && p5->b == 0 && p5->c == 0 && p5->d == 0); } @@ -209,7 +211,9 @@ void test_make_shared_array_known_bounds() { shared_ptr p6 = make_shared(); assert_shared_use_get(p6); +#ifdef __cpp_aligned_new assert(reinterpret_cast(p6.get()) % alignof(HighlyAligned) == 0); +#endif // ^^^ defined(__cpp_aligned_new) ^^^ for (int i = 0; i < 6; ++i) { assert(p6[i].a == 0 && p6[i].b == 0 && p6[i].c == 0 && p6[i].d == 0); } @@ -279,7 +283,9 @@ void test_make_shared_array_unknown_bounds() { shared_ptr p7 = make_shared(7u); assert_shared_use_get(p7); +#ifdef __cpp_aligned_new assert(reinterpret_cast(p7.get()) % alignof(HighlyAligned) == 0); +#endif // ^^^ defined(__cpp_aligned_new) ^^^ for (int i = 0; i < 7; ++i) { assert(p7[i].a == 0 && p7[i].b == 0 && p7[i].c == 0 && p7[i].d == 0); } @@ -422,7 +428,9 @@ void test_allocate_shared_not_array() { { shared_ptr p5 = allocate_shared(a5); assert_shared_use_get(p5); +#ifdef __cpp_aligned_new assert(reinterpret_cast(p5.get()) % alignof(HighlyAligned) == 0); +#endif // ^^^ defined(__cpp_aligned_new) ^^^ assert(p5->a == 0 && p5->b == 0 && p5->c == 0 && p5->d == 0); } assert_construct_destruct_equal(); @@ -502,7 +510,9 @@ void test_allocate_shared_array_known_bounds() { { shared_ptr p6 = allocate_shared(a6); assert_shared_use_get(p6); +#ifdef __cpp_aligned_new assert(reinterpret_cast(p6.get()) % alignof(HighlyAligned) == 0); +#endif // ^^^ defined(__cpp_aligned_new) ^^^ for (int i = 0; i < 6; ++i) { assert(p6[i].a == 0 && p6[i].b == 0 && p6[i].c == 0 && p6[i].d == 0); } @@ -603,7 +613,9 @@ void test_allocate_shared_array_unknown_bounds() { { shared_ptr p7 = allocate_shared(a7, 7u); assert_shared_use_get(p7); +#ifdef __cpp_aligned_new assert(reinterpret_cast(p7.get()) % alignof(HighlyAligned) == 0); +#endif // ^^^ defined(__cpp_aligned_new) ^^^ for (int i = 0; i < 7; ++i) { assert(p7[i].a == 0 && p7[i].b == 0 && p7[i].c == 0 && p7[i].d == 0); } From 849b3c478f05248b4cf2ae3bc209765fd4e5a37d Mon Sep 17 00:00:00 2001 From: Alex Guteniev Date: Sun, 15 Feb 2026 18:05:03 +0200 Subject: [PATCH 07/14] fix P1020R1_smart_pointer_for_overwrite --- tests/std/tests/P1020R1_smart_pointer_for_overwrite/test.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/std/tests/P1020R1_smart_pointer_for_overwrite/test.cpp b/tests/std/tests/P1020R1_smart_pointer_for_overwrite/test.cpp index 0150ccff944..a4bec125c76 100644 --- a/tests/std/tests/P1020R1_smart_pointer_for_overwrite/test.cpp +++ b/tests/std/tests/P1020R1_smart_pointer_for_overwrite/test.cpp @@ -288,7 +288,9 @@ void test_allocate_shared_for_overwrite() { allocator a2{}; auto p2 = allocate_shared_for_overwrite_assert(a2); +#ifdef __cpp_aligned_new assert(reinterpret_cast(p2.get()) % alignof(HighlyAligned) == 0); +#endif // ^^^ defined(__cpp_aligned_new) ^^^ assert_uninitialized(addressof(*p2), sizeof(HighlyAligned)); auto p3 = allocate_shared_for_overwrite_assert(a0); From 247fa29bd36681f37294e7083d697b940a158b7f Mon Sep 17 00:00:00 2001 From: Alex Guteniev Date: Sun, 15 Feb 2026 18:06:07 +0200 Subject: [PATCH 08/14] Down for 17. We know pmr is broken --- tests/std/tests/P0035R4_over_aligned_allocation/test.cpp | 4 ++++ tests/std/tests/P0220R1_polymorphic_memory_resources/test.cpp | 4 ++++ tests/std/tests/usual_17_matrix.lst | 2 ++ 3 files changed, 10 insertions(+) diff --git a/tests/std/tests/P0035R4_over_aligned_allocation/test.cpp b/tests/std/tests/P0035R4_over_aligned_allocation/test.cpp index ac66ca4024a..c191f118767 100644 --- a/tests/std/tests/P0035R4_over_aligned_allocation/test.cpp +++ b/tests/std/tests/P0035R4_over_aligned_allocation/test.cpp @@ -1,6 +1,9 @@ // Copyright (c) Microsoft Corporation. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +#ifndef __cpp_aligned_new +int main() {{ +#else // ^^^ !defined(__cpp_aligned_new) / defined(__cpp_aligned_new) vvv #define _ENABLE_EXTENDED_ALIGNED_STORAGE #define _HAS_DEPRECATED_TEMPORARY_BUFFER 1 #define _SILENCE_CXX17_TEMPORARY_BUFFER_DEPRECATION_WARNING @@ -86,3 +89,4 @@ int main() { // for every x in [0, max_align_log)... test_alignments(std::make_index_sequence{}); } +#endif // ^^^ defined(__cpp_aligned_new) ^^^ diff --git a/tests/std/tests/P0220R1_polymorphic_memory_resources/test.cpp b/tests/std/tests/P0220R1_polymorphic_memory_resources/test.cpp index 12dd09f6891..59c68e79ae5 100644 --- a/tests/std/tests/P0220R1_polymorphic_memory_resources/test.cpp +++ b/tests/std/tests/P0220R1_polymorphic_memory_resources/test.cpp @@ -1,6 +1,9 @@ // Copyright (c) Microsoft Corporation. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +#ifndef __cpp_aligned_new +int main() {} +#else // ^^^ !defined(__cpp_aligned_new) / defined(__cpp_aligned_new) vvv #define _SILENCE_CXX23_ALIGNED_UNION_DEPRECATION_WARNING #include @@ -1642,3 +1645,4 @@ int main() { test_gh3408(); } +#endif // ^^^ defined(__cpp_aligned_new) ^^^ diff --git a/tests/std/tests/usual_17_matrix.lst b/tests/std/tests/usual_17_matrix.lst index d5ec4eda0df..4130768a994 100644 --- a/tests/std/tests/usual_17_matrix.lst +++ b/tests/std/tests/usual_17_matrix.lst @@ -5,6 +5,8 @@ RUNALL_INCLUDE .\prefix.lst RUNALL_CROSSLIST * PM_CL="/w14640 /Zc:threadSafeInit-" RUNALL_CROSSLIST +PM_CL="/EHsc /MD /D_ITERATOR_DEBUG_LEVEL=0 /std:c++latest /permissive- /Zc:alignedNew- /wd4316" +ASAN PM_CL="/EHsc /MD /std:c++latest /permissive- /Zc:alignedNew- /wd4316 -fsanitize=address /Zi" PM_LINK="/debug" PM_CL="/EHsc /MD /D_ITERATOR_DEBUG_LEVEL=0 /std:c++latest /permissive- /Zc:noexceptTypes-" ASAN PM_CL="/EHsc /MD /std:c++latest /permissive- /Zc:noexceptTypes- -fsanitize=address /Zi" PM_LINK="/debug" PM_CL="/EHsc /MD /D_ITERATOR_DEBUG_LEVEL=0 /std:c++17" From 81bc93f36112649e89916bad1f9b16db6358bdd9 Mon Sep 17 00:00:00 2001 From: Alex Guteniev Date: Sun, 15 Feb 2026 18:14:29 +0200 Subject: [PATCH 09/14] typo --- tests/std/tests/P0035R4_over_aligned_allocation/test.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/std/tests/P0035R4_over_aligned_allocation/test.cpp b/tests/std/tests/P0035R4_over_aligned_allocation/test.cpp index c191f118767..7e8cf835650 100644 --- a/tests/std/tests/P0035R4_over_aligned_allocation/test.cpp +++ b/tests/std/tests/P0035R4_over_aligned_allocation/test.cpp @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception #ifndef __cpp_aligned_new -int main() {{ +int main() {} #else // ^^^ !defined(__cpp_aligned_new) / defined(__cpp_aligned_new) vvv #define _ENABLE_EXTENDED_ALIGNED_STORAGE #define _HAS_DEPRECATED_TEMPORARY_BUFFER 1 From 4badbf9029a9fe166e895254bf887f2d30ab8da7 Mon Sep 17 00:00:00 2001 From: Alex Guteniev Date: Sun, 15 Feb 2026 18:52:21 +0200 Subject: [PATCH 10/14] Any --- tests/std/tests/P0220R1_any/test.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/std/tests/P0220R1_any/test.cpp b/tests/std/tests/P0220R1_any/test.cpp index 391bb7b0ed1..8ecee8e4006 100644 --- a/tests/std/tests/P0220R1_any/test.cpp +++ b/tests/std/tests/P0220R1_any/test.cpp @@ -26,6 +26,9 @@ // Yes, this is an awkward hand process; notably the required headers can change without notice. We should investigate // running the libc++ tests directly in all of our configurations so we needn't replicate this subset of files. +#ifndef __cpp_aligned_new +int main() {} +#else // ^^^ !defined(__cpp_aligned_new) / defined(__cpp_aligned_new) vvv #define _LIBCXX_IN_DEVCRT #include // Must precede any other libc++ headers #include @@ -3208,3 +3211,4 @@ int main() { msvc::gh_140_robust_against_adl::run_test(); #endif // _M_CEE } +#endif // ^^^ defined(__cpp_aligned_new) ^^^ From ca5aad5c60214d7edb0ba550f2de2019f345cc2f Mon Sep 17 00:00:00 2001 From: Alex Guteniev Date: Sun, 15 Feb 2026 18:56:54 +0200 Subject: [PATCH 11/14] Down to usual --- tests/std/tests/impure_matrix.lst | 2 ++ tests/std/tests/usual_matrix.lst | 2 ++ 2 files changed, 4 insertions(+) diff --git a/tests/std/tests/impure_matrix.lst b/tests/std/tests/impure_matrix.lst index a1920cd1ed9..3668272f1f4 100644 --- a/tests/std/tests/impure_matrix.lst +++ b/tests/std/tests/impure_matrix.lst @@ -8,6 +8,8 @@ RUNALL_INCLUDE .\prefix.lst RUNALL_CROSSLIST * PM_CL="/w14640 /Zc:threadSafeInit-" RUNALL_CROSSLIST +PM_CL="/EHsc /MD /D_ITERATOR_DEBUG_LEVEL=0 /std:c++latest /permissive- /Zc:alignedNew- /wd4316" +ASAN PM_CL="/EHsc /MD /std:c++latest /permissive- /Zc:alignedNew- /wd4316 -fsanitize=address /Zi" PM_LINK="/debug" PM_CL="/EHsc /MD /D_ITERATOR_DEBUG_LEVEL=0 /std:c++14" ASAN PM_CL="/EHsc /MD /std:c++14 -fsanitize=address /Zi" PM_LINK="/debug" PM_CL="/EHsc /MD /D_ITERATOR_DEBUG_LEVEL=0 /std:c++17" diff --git a/tests/std/tests/usual_matrix.lst b/tests/std/tests/usual_matrix.lst index 07b2a1f63a9..c6d18bc7a9a 100644 --- a/tests/std/tests/usual_matrix.lst +++ b/tests/std/tests/usual_matrix.lst @@ -7,6 +7,8 @@ RUNALL_INCLUDE .\prefix.lst RUNALL_CROSSLIST +PM_CL="/EHsc /MD /D_ITERATOR_DEBUG_LEVEL=0 /std:c++latest /permissive- /Zc:alignedNew- /wd4316" +ASAN PM_CL="/EHsc /MD /std:c++latest /permissive- /Zc:alignedNew- /wd4316 -fsanitize=address /Zi" PM_LINK="/debug" PM_CL="/EHsc /MD /D_ITERATOR_DEBUG_LEVEL=0 /std:c++14 /w14640 /Zc:threadSafeInit-" ASAN PM_CL="/EHsc /MD /std:c++14 /w14640 /Zc:threadSafeInit- -fsanitize=address /Zi" PM_LINK="/debug" PM_CL="/EHsc /MD /D_ITERATOR_DEBUG_LEVEL=0 /std:c++17 /w14640 /Zc:threadSafeInit-" From 321013dc6381fffdd90db4db9c59fd2f6ec7a507 Mon Sep 17 00:00:00 2001 From: Alex Guteniev Date: Sun, 15 Feb 2026 19:26:54 +0200 Subject: [PATCH 12/14] leave Matrix --- tests/std/tests/impure_matrix.lst | 2 -- tests/std/tests/strict_20_matrix.lst | 2 -- tests/std/tests/strict_latest_matrix.lst | 2 -- tests/std/tests/usual_17_matrix.lst | 2 -- tests/std/tests/usual_20_matrix.lst | 2 -- tests/std/tests/usual_latest_matrix.lst | 2 -- tests/std/tests/usual_matrix.lst | 2 -- 7 files changed, 14 deletions(-) diff --git a/tests/std/tests/impure_matrix.lst b/tests/std/tests/impure_matrix.lst index 3668272f1f4..a1920cd1ed9 100644 --- a/tests/std/tests/impure_matrix.lst +++ b/tests/std/tests/impure_matrix.lst @@ -8,8 +8,6 @@ RUNALL_INCLUDE .\prefix.lst RUNALL_CROSSLIST * PM_CL="/w14640 /Zc:threadSafeInit-" RUNALL_CROSSLIST -PM_CL="/EHsc /MD /D_ITERATOR_DEBUG_LEVEL=0 /std:c++latest /permissive- /Zc:alignedNew- /wd4316" -ASAN PM_CL="/EHsc /MD /std:c++latest /permissive- /Zc:alignedNew- /wd4316 -fsanitize=address /Zi" PM_LINK="/debug" PM_CL="/EHsc /MD /D_ITERATOR_DEBUG_LEVEL=0 /std:c++14" ASAN PM_CL="/EHsc /MD /std:c++14 -fsanitize=address /Zi" PM_LINK="/debug" PM_CL="/EHsc /MD /D_ITERATOR_DEBUG_LEVEL=0 /std:c++17" diff --git a/tests/std/tests/strict_20_matrix.lst b/tests/std/tests/strict_20_matrix.lst index be35061a87d..c4ea4e65407 100644 --- a/tests/std/tests/strict_20_matrix.lst +++ b/tests/std/tests/strict_20_matrix.lst @@ -7,8 +7,6 @@ RUNALL_INCLUDE .\prefix.lst RUNALL_CROSSLIST * PM_CL="/w14640 /Zc:threadSafeInit- /permissive-" RUNALL_CROSSLIST -PM_CL="/EHsc /MD /D_ITERATOR_DEBUG_LEVEL=0 /std:c++latest /permissive- /Zc:alignedNew- /wd4316" -ASAN PM_CL="/EHsc /MD /std:c++latest /permissive- /Zc:alignedNew- /wd4316 -fsanitize=address /Zi" PM_LINK="/debug" PM_CL="/EHsc /MD /D_ITERATOR_DEBUG_LEVEL=0 /std:c++20 /Zc:noexceptTypes-" ASAN PM_CL="/EHsc /MD /std:c++20 /Zc:noexceptTypes- -fsanitize=address /Zi" PM_LINK="/debug" PM_CL="/EHsc /MD /D_ITERATOR_DEBUG_LEVEL=1 /std:c++latest" diff --git a/tests/std/tests/strict_latest_matrix.lst b/tests/std/tests/strict_latest_matrix.lst index dd220035914..b67794f67cb 100644 --- a/tests/std/tests/strict_latest_matrix.lst +++ b/tests/std/tests/strict_latest_matrix.lst @@ -15,8 +15,6 @@ PM_CL="/MD /D_ITERATOR_DEBUG_LEVEL=0 /Zc:char8_t- /Zc:preprocessor" ASAN PM_CL="/MD /Zc:char8_t- /Zc:preprocessor -fsanitize=address /Zi" PM_LINK="/debug" PM_CL="/MDd /D_ITERATOR_DEBUG_LEVEL=0 /Zc:wchar_t-" ASAN PM_CL="/MDd /Zc:wchar_t- -fsanitize=address /Zi" PM_LINK="/debug" -PM_CL="/MD /D_ITERATOR_DEBUG_LEVEL=0 /permissive- /Zc:alignedNew-" -ASAN PM_CL="/MD /permissive- /Zc:alignedNew- -fsanitize=address /Zi" PM_LINK="/debug" PM_CL="/MDd /D_ITERATOR_DEBUG_LEVEL=1" ASAN PM_CL="/MDd -fsanitize=address /Zi" PM_LINK="/debug" PM_CL="/MDd /D_ITERATOR_DEBUG_LEVEL=2 /fp:except /Zc:preprocessor" diff --git a/tests/std/tests/usual_17_matrix.lst b/tests/std/tests/usual_17_matrix.lst index 4130768a994..d5ec4eda0df 100644 --- a/tests/std/tests/usual_17_matrix.lst +++ b/tests/std/tests/usual_17_matrix.lst @@ -5,8 +5,6 @@ RUNALL_INCLUDE .\prefix.lst RUNALL_CROSSLIST * PM_CL="/w14640 /Zc:threadSafeInit-" RUNALL_CROSSLIST -PM_CL="/EHsc /MD /D_ITERATOR_DEBUG_LEVEL=0 /std:c++latest /permissive- /Zc:alignedNew- /wd4316" -ASAN PM_CL="/EHsc /MD /std:c++latest /permissive- /Zc:alignedNew- /wd4316 -fsanitize=address /Zi" PM_LINK="/debug" PM_CL="/EHsc /MD /D_ITERATOR_DEBUG_LEVEL=0 /std:c++latest /permissive- /Zc:noexceptTypes-" ASAN PM_CL="/EHsc /MD /std:c++latest /permissive- /Zc:noexceptTypes- -fsanitize=address /Zi" PM_LINK="/debug" PM_CL="/EHsc /MD /D_ITERATOR_DEBUG_LEVEL=0 /std:c++17" diff --git a/tests/std/tests/usual_20_matrix.lst b/tests/std/tests/usual_20_matrix.lst index 414110511ff..8964140309b 100644 --- a/tests/std/tests/usual_20_matrix.lst +++ b/tests/std/tests/usual_20_matrix.lst @@ -5,8 +5,6 @@ RUNALL_INCLUDE .\prefix.lst RUNALL_CROSSLIST * PM_CL="/w14640 /Zc:threadSafeInit-" RUNALL_CROSSLIST -PM_CL="/EHsc /MD /D_ITERATOR_DEBUG_LEVEL=0 /std:c++latest /permissive- /Zc:alignedNew- /wd4316" -ASAN PM_CL="/EHsc /MD /std:c++latest /permissive- /Zc:alignedNew- /wd4316 -fsanitize=address /Zi" PM_LINK="/debug" PM_CL="/EHsc /MD /D_ITERATOR_DEBUG_LEVEL=0 /std:c++20 /permissive- /Zc:noexceptTypes-" ASAN PM_CL="/EHsc /MD /std:c++20 /permissive- /Zc:noexceptTypes- -fsanitize=address /Zi" PM_LINK="/debug" PM_CL="/EHsc /MD /D_ITERATOR_DEBUG_LEVEL=1 /std:c++latest /permissive-" diff --git a/tests/std/tests/usual_latest_matrix.lst b/tests/std/tests/usual_latest_matrix.lst index 859a515c1eb..1e3d4da8cd9 100644 --- a/tests/std/tests/usual_latest_matrix.lst +++ b/tests/std/tests/usual_latest_matrix.lst @@ -11,8 +11,6 @@ PM_CL="/MD /D_ITERATOR_DEBUG_LEVEL=1 /permissive-" ASAN PM_CL="/MD /permissive- -fsanitize=address /Zi" PM_LINK="/debug" PM_CL="/MD /D_ITERATOR_DEBUG_LEVEL=0 /permissive- /Zc:char8_t-" ASAN PM_CL="/MD /permissive- /Zc:char8_t- -fsanitize=address /Zi" PM_LINK="/debug" -PM_CL="/MD /D_ITERATOR_DEBUG_LEVEL=0 /permissive- /Zc:alignedNew-" -ASAN PM_CL="/MD /permissive- /Zc:alignedNew- -fsanitize=address /Zi" PM_LINK="/debug" PM_CL="/MDd /D_ITERATOR_DEBUG_LEVEL=0 /permissive- /Zc:wchar_t- /Zc:preprocessor" ASAN PM_CL="/MDd /permissive- /Zc:wchar_t- /Zc:preprocessor -fsanitize=address /Zi" PM_LINK="/debug" PM_CL="/MDd /D_ITERATOR_DEBUG_LEVEL=1 /permissive-" diff --git a/tests/std/tests/usual_matrix.lst b/tests/std/tests/usual_matrix.lst index c6d18bc7a9a..07b2a1f63a9 100644 --- a/tests/std/tests/usual_matrix.lst +++ b/tests/std/tests/usual_matrix.lst @@ -7,8 +7,6 @@ RUNALL_INCLUDE .\prefix.lst RUNALL_CROSSLIST -PM_CL="/EHsc /MD /D_ITERATOR_DEBUG_LEVEL=0 /std:c++latest /permissive- /Zc:alignedNew- /wd4316" -ASAN PM_CL="/EHsc /MD /std:c++latest /permissive- /Zc:alignedNew- /wd4316 -fsanitize=address /Zi" PM_LINK="/debug" PM_CL="/EHsc /MD /D_ITERATOR_DEBUG_LEVEL=0 /std:c++14 /w14640 /Zc:threadSafeInit-" ASAN PM_CL="/EHsc /MD /std:c++14 /w14640 /Zc:threadSafeInit- -fsanitize=address /Zi" PM_LINK="/debug" PM_CL="/EHsc /MD /D_ITERATOR_DEBUG_LEVEL=0 /std:c++17 /w14640 /Zc:threadSafeInit-" From 2f6f54e2965ca28b7017a82884fadaa0ccb631da Mon Sep 17 00:00:00 2001 From: Alex Guteniev Date: Sun, 15 Feb 2026 19:35:08 +0200 Subject: [PATCH 13/14] admit defeat for these --- tests/std/tests/P0035R4_over_aligned_allocation/test.cpp | 8 ++++---- tests/std/tests/P0220R1_any/test.cpp | 8 ++++---- .../tests/P0220R1_polymorphic_memory_resources/test.cpp | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/tests/std/tests/P0035R4_over_aligned_allocation/test.cpp b/tests/std/tests/P0035R4_over_aligned_allocation/test.cpp index 7e8cf835650..def78d0f8d5 100644 --- a/tests/std/tests/P0035R4_over_aligned_allocation/test.cpp +++ b/tests/std/tests/P0035R4_over_aligned_allocation/test.cpp @@ -1,9 +1,10 @@ // Copyright (c) Microsoft Corporation. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -#ifndef __cpp_aligned_new -int main() {} -#else // ^^^ !defined(__cpp_aligned_new) / defined(__cpp_aligned_new) vvv +#if !defined(__cpp_aligned_new) +#error overaligned allocation does not work with /Zc:alignedNew- +#endif + #define _ENABLE_EXTENDED_ALIGNED_STORAGE #define _HAS_DEPRECATED_TEMPORARY_BUFFER 1 #define _SILENCE_CXX17_TEMPORARY_BUFFER_DEPRECATION_WARNING @@ -89,4 +90,3 @@ int main() { // for every x in [0, max_align_log)... test_alignments(std::make_index_sequence{}); } -#endif // ^^^ defined(__cpp_aligned_new) ^^^ diff --git a/tests/std/tests/P0220R1_any/test.cpp b/tests/std/tests/P0220R1_any/test.cpp index 8ecee8e4006..6ce91a8f653 100644 --- a/tests/std/tests/P0220R1_any/test.cpp +++ b/tests/std/tests/P0220R1_any/test.cpp @@ -26,9 +26,10 @@ // Yes, this is an awkward hand process; notably the required headers can change without notice. We should investigate // running the libc++ tests directly in all of our configurations so we needn't replicate this subset of files. -#ifndef __cpp_aligned_new -int main() {} -#else // ^^^ !defined(__cpp_aligned_new) / defined(__cpp_aligned_new) vvv +#if !defined(__cpp_aligned_new) +#error This test relies on libc++ machinery which assumes overaligned allocation support since C++17 +#endif + #define _LIBCXX_IN_DEVCRT #include // Must precede any other libc++ headers #include @@ -3211,4 +3212,3 @@ int main() { msvc::gh_140_robust_against_adl::run_test(); #endif // _M_CEE } -#endif // ^^^ defined(__cpp_aligned_new) ^^^ diff --git a/tests/std/tests/P0220R1_polymorphic_memory_resources/test.cpp b/tests/std/tests/P0220R1_polymorphic_memory_resources/test.cpp index 59c68e79ae5..31d32431edf 100644 --- a/tests/std/tests/P0220R1_polymorphic_memory_resources/test.cpp +++ b/tests/std/tests/P0220R1_polymorphic_memory_resources/test.cpp @@ -1,9 +1,10 @@ // Copyright (c) Microsoft Corporation. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -#ifndef __cpp_aligned_new -int main() {} -#else // ^^^ !defined(__cpp_aligned_new) / defined(__cpp_aligned_new) vvv +#if !defined(__cpp_aligned_new) +#error pmr does not completely work with /Zc:alignedNew- +#endif + #define _SILENCE_CXX23_ALIGNED_UNION_DEPRECATION_WARNING #include @@ -1645,4 +1646,3 @@ int main() { test_gh3408(); } -#endif // ^^^ defined(__cpp_aligned_new) ^^^ From 9ad116dbda205887461f27eb9097fb0b015fa5a8 Mon Sep 17 00:00:00 2001 From: Alex Guteniev Date: Sun, 15 Feb 2026 19:43:36 +0200 Subject: [PATCH 14/14] format again --- tests/std/tests/P0035R4_over_aligned_allocation/test.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/std/tests/P0035R4_over_aligned_allocation/test.cpp b/tests/std/tests/P0035R4_over_aligned_allocation/test.cpp index def78d0f8d5..78e26b528bd 100644 --- a/tests/std/tests/P0035R4_over_aligned_allocation/test.cpp +++ b/tests/std/tests/P0035R4_over_aligned_allocation/test.cpp @@ -3,7 +3,7 @@ #if !defined(__cpp_aligned_new) #error overaligned allocation does not work with /Zc:alignedNew- -#endif +#endif #define _ENABLE_EXTENDED_ALIGNED_STORAGE #define _HAS_DEPRECATED_TEMPORARY_BUFFER 1