diff --git a/tests/std/tests/Dev11_0000000_null_forward_iterators/test.cpp b/tests/std/tests/Dev11_0000000_null_forward_iterators/test.cpp index 94008bd066a..b548e3d443d 100644 --- a/tests/std/tests/Dev11_0000000_null_forward_iterators/test.cpp +++ b/tests/std/tests/Dev11_0000000_null_forward_iterators/test.cpp @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -#define _SILENCE_CXX23_ALIGNED_UNION_DEPRECATION_WARNING #define _SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING #define _SILENCE_STDEXT_ARR_ITERS_DEPRECATION_WARNING @@ -10,7 +9,6 @@ #include #include #include -#include #include #include #include @@ -18,13 +16,21 @@ #include #include #include -#include #include #include #include #include #include +#if _HAS_CXX17 +#include +#include +#endif // _HAS_CXX17 + +#if _HAS_CXX20 +#include +#endif // _HAS_CXX20 + using namespace std; // N3797 24.2.5 [forward.iterators]/2: @@ -91,14 +97,14 @@ void test_iterator() { } { - aligned_union_t<0, FwdIt> au3; - aligned_union_t<0, FwdIt> au4; + alignas(FwdIt) unsigned char buf3[sizeof(FwdIt)]; + alignas(FwdIt) unsigned char buf4[sizeof(FwdIt)]; - FwdIt* p3 = reinterpret_cast(&au3); - FwdIt* p4 = reinterpret_cast(&au4); + memset(buf3, 0xCC, sizeof(FwdIt)); + memset(buf4, 0xDD, sizeof(FwdIt)); - memset(p3, 0xCC, sizeof(FwdIt)); - memset(p4, 0xDD, sizeof(FwdIt)); + FwdIt* p3 = reinterpret_cast(buf3); + FwdIt* p4 = reinterpret_cast(buf4); new (p3) FwdIt{}; new (p4) FwdIt{};