From 2581b339f91df83b9d41791c9420d2edc8933490 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Fri, 2 Feb 2024 00:24:33 -0800 Subject: [PATCH 01/29] Preprocessor FC: Guard an MSVC workaround. --- stl/inc/variant | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/stl/inc/variant b/stl/inc/variant index 071271d8682..bf6db22f2ce 100644 --- a/stl/inc/variant +++ b/stl/inc/variant @@ -1425,7 +1425,9 @@ struct _Variant_dispatcher> { template _NODISCARD static constexpr _Ret _Dispatch2(_Callable&& _Obj, _Types&&... _Args) { if constexpr (_Any_valueless) { - ((void) _Args, ...); // TRANSITION, VSO-1513409 +#if !defined(__clang__) && !defined(__EDG__) // TRANSITION, VSO-1513409 + ((void) _Args, ...); +#endif // ^^^ workaround ^^^ _STD _Throw_bad_variant_access(); } #if _HAS_CXX20 From a49a37d9bc95f1c3e25ec5239451341988047593 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Fri, 2 Feb 2024 00:28:53 -0800 Subject: [PATCH 02/29] Preprocessor FC: Allow EDG (in addition to Clang) to run test cases that only MSVC has trouble with. --- tests/std/tests/P1614R2_spaceship/test.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/std/tests/P1614R2_spaceship/test.cpp b/tests/std/tests/P1614R2_spaceship/test.cpp index 92d819d8a0f..6b7ba2df1d4 100644 --- a/tests/std/tests/P1614R2_spaceship/test.cpp +++ b/tests/std/tests/P1614R2_spaceship/test.cpp @@ -1061,9 +1061,9 @@ void ordering_test_cases() { spaceship_test(double_seconds{1}, float_milliseconds{1000}, ntsc_fields{60}); constexpr double_seconds nan_s{std::numeric_limits::quiet_NaN()}; -#ifdef __clang__ // TRANSITION, DevCom-445462 +#if defined(__clang__) || defined(__EDG__) // TRANSITION, DevCom-445462 static_assert(nan_s <=> nan_s == std::partial_ordering::unordered); -#endif // defined(__clang__) +#endif // ^^^ no workaround ^^^ assert(nan_s <=> nan_s == std::partial_ordering::unordered); } { // chrono::time_point @@ -1077,9 +1077,9 @@ void ordering_test_cases() { spaceship_test(sys_tp{}, sys_double_s{}, sys_double_s{double_seconds{1}}); constexpr sys_double_s nan_tp{double_seconds{std::numeric_limits::quiet_NaN()}}; -#ifdef __clang__ // TRANSITION, DevCom-445462 +#if defined(__clang__) || defined(__EDG__) // TRANSITION, DevCom-445462 static_assert(nan_tp <=> nan_tp == std::partial_ordering::unordered); -#endif // defined(__clang__) +#endif // ^^^ no workaround ^^^ assert(nan_tp <=> nan_tp == std::partial_ordering::unordered); using steady_tp = std::chrono::steady_clock::time_point; From 77371e49cbc71460cc7950c6b6c8705c44dc46e6 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Fri, 2 Feb 2024 00:39:18 -0800 Subject: [PATCH 03/29] Preprocessor FC: Avoid a hidden "assert bug" scenario. In C++23 mode, we should simply skip EDG instead of expecting it to give the wrong answer. This is VSO-1601179 "REPORTED: EDG's overload resolution incorrectly considers some ambiguous conversions to be unambiguous". --- tests/std/tests/GH_003022_substr_allocator/test.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/std/tests/GH_003022_substr_allocator/test.cpp b/tests/std/tests/GH_003022_substr_allocator/test.cpp index d6d26b36370..3ea2b0b0cbb 100644 --- a/tests/std/tests/GH_003022_substr_allocator/test.cpp +++ b/tests/std/tests/GH_003022_substr_allocator/test.cpp @@ -174,11 +174,13 @@ CONSTEXPR20 bool test_substr_allocator() { } }; -#if _HAS_CXX23 && !defined(__EDG__) // TRANSITION, VSO-1601179 +#if _HAS_CXX23 +#ifndef __EDG__ // TRANSITION, VSO-1601179 static_assert(!is_constructible_v, "This should be ambiguous"); -#else // _HAS_CXX23 && !defined(__EDG__) +#endif // ^^^ no workaround ^^^ +#else // ^^^ _HAS_CXX23 / !_HAS_CXX23 vvv static_assert(is_constructible_v, "This should be unambiguous"); -#endif // _HAS_CXX23 && !defined(__EDG__) +#endif // ^^^ !_HAS_CXX23 ^^^ return true; } From 34c9f13c9d6572f9c0c59b0b6543283bbab2490e Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Fri, 2 Feb 2024 00:16:03 -0800 Subject: [PATCH 04/29] Preprocessor NFC: Guard with `__cpp_lib_is_layout_compatible` and `__cpp_lib_is_pointer_interconvertible`. This has the same effect, and is still marked with `// TRANSITION, LLVM-48860` as a reminder. I think this makes the `#endif` comment clearer, as it's separated by a huge distance and contains nested preprocessor logic. Checking the feature-test macros instead of the compiler also makes it clearer what to do in the future, even without "no workaround" to tell us. --- .../test.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/std/tests/P0466R5_layout_compatibility_and_pointer_interconvertibility_traits/test.cpp b/tests/std/tests/P0466R5_layout_compatibility_and_pointer_interconvertibility_traits/test.cpp index 14d6bafb99b..671c5a64d79 100644 --- a/tests/std/tests/P0466R5_layout_compatibility_and_pointer_interconvertibility_traits/test.cpp +++ b/tests/std/tests/P0466R5_layout_compatibility_and_pointer_interconvertibility_traits/test.cpp @@ -14,7 +14,7 @@ struct S { // Must be declared at namespace scope due to static data member }; constexpr bool test() { -#ifndef __clang__ // TRANSITION, LLVM-48860 +#if defined(__cpp_lib_is_layout_compatible) && defined(__cpp_lib_is_pointer_interconvertible) // TRANSITION, LLVM-48860 // is_layout_compatible tests { struct S0 { @@ -242,7 +242,7 @@ constexpr bool test() { ASSERT(!is_pointer_interconvertible_with_class(&C::f1)); ASSERT(!is_pointer_interconvertible_with_class(static_cast(nullptr))); } -#endif // __clang__ +#endif // ^^^ defined(__cpp_lib_is_layout_compatible) && defined(__cpp_lib_is_pointer_interconvertible) ^^^ return true; } From fd5ffe208a36bba8717c0b3d771c572fa36a246b Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Fri, 2 Feb 2024 01:38:53 -0800 Subject: [PATCH 05/29] Preprocessor NFC: We conventionally use the order `defined(__clang__) || defined(__EDG__)`. --- .../tests/P2273R3_constexpr_unique_ptr/test.compile.pass.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/std/tests/P2273R3_constexpr_unique_ptr/test.compile.pass.cpp b/tests/std/tests/P2273R3_constexpr_unique_ptr/test.compile.pass.cpp index 6ec147cb59a..16c103a389f 100644 --- a/tests/std/tests/P2273R3_constexpr_unique_ptr/test.compile.pass.cpp +++ b/tests/std/tests/P2273R3_constexpr_unique_ptr/test.compile.pass.cpp @@ -23,7 +23,7 @@ constexpr bool test_P2273R3_constexpr_unique_ptr() { assert(p1 == p1); assert(p1 != p2); -#if defined(__EDG__) || defined(__clang__) // TRANSITION, DevCom-1436243 +#if defined(__clang__) || defined(__EDG__) // TRANSITION, DevCom-1436243 auto p3 = make_unique(10); auto p4 = make_unique_for_overwrite(4); swap(p3, p4); From 27b03931d422bbb8ef6f6473c98978b4c0955ac8 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Fri, 2 Feb 2024 01:44:33 -0800 Subject: [PATCH 06/29] Preprocessor NFC: We conventionally use the order `!defined(__clang__) && !defined(__EDG__)`. --- stl/inc/type_traits | 6 +++--- stl/inc/xstring | 2 +- .../tests/VSO_0429900_fast_debug_range_based_for/test.cpp | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/stl/inc/type_traits b/stl/inc/type_traits index 0d121913bf4..984c07870f4 100644 --- a/stl/inc/type_traits +++ b/stl/inc/type_traits @@ -327,7 +327,7 @@ struct is_convertible : bool_constant<__is_convertible_to(_From, _To)> { _EXPORT_STD template _INLINE_VAR constexpr bool is_convertible_v = __is_convertible_to(_From, _To); -#if !defined(__EDG__) && !defined(__clang__) // TRANSITION, DevCom-1627396 +#if !defined(__clang__) && !defined(__EDG__) // TRANSITION, DevCom-1627396 template struct is_convertible<_Ty&, volatile _Ty&> : true_type {}; @@ -1409,7 +1409,7 @@ struct _Add_qualifiers<_Ty1&&> { using _Apply = add_rvalue_reference_t<_Copy_cv<_Ty1, _Ty2>>; }; -#if !defined(__EDG__) && !defined(__clang__) // TRANSITION, DevCom-10095944 +#if !defined(__clang__) && !defined(__EDG__) // TRANSITION, DevCom-10095944 template using _Cond_res_if_right = // N4950 [meta.trans.other]/2.4 decltype(false ? _Returns_exactly<_Ty1>() : _Returns_exactly<_Ty2>()); @@ -2239,7 +2239,7 @@ struct _Is_trivially_swappable : bool_constant<_Is_trivially_swappable_v<_Ty>> { #ifdef __cpp_lib_concepts // TRANSITION, GH-395 _EXPORT_STD template concept convertible_to = -#if !defined(__EDG__) && !defined(__clang__) // TRANSITION, DevCom-1627396 +#if !defined(__clang__) && !defined(__EDG__) // TRANSITION, DevCom-1627396 is_convertible_v<_From, _To> #else // ^^^ workaround / no workaround vvv __is_convertible_to(_From, _To) diff --git a/stl/inc/xstring b/stl/inc/xstring index c34ee4fd0ec..770b5d9e9ad 100644 --- a/stl/inc/xstring +++ b/stl/inc/xstring @@ -346,7 +346,7 @@ template <> struct char_traits : _WChar_traits {}; #endif // defined(_CRTBLD) -#if defined(__cpp_char8_t) && !defined(__EDG__) && !defined(__clang__) +#if defined(__cpp_char8_t) && !defined(__clang__) && !defined(__EDG__) #define _HAS_U8_INTRINSICS 1 #else // ^^^ Use intrinsics for char8_t / don't use said intrinsics vvv #define _HAS_U8_INTRINSICS 0 diff --git a/tests/std/tests/VSO_0429900_fast_debug_range_based_for/test.cpp b/tests/std/tests/VSO_0429900_fast_debug_range_based_for/test.cpp index 238419a844d..2524cd51c6c 100644 --- a/tests/std/tests/VSO_0429900_fast_debug_range_based_for/test.cpp +++ b/tests/std/tests/VSO_0429900_fast_debug_range_based_for/test.cpp @@ -106,7 +106,7 @@ void test_case_sequence_container() { assert(dec.beginCalled); assert(dec.endCalled); -#if !defined(__EDG__) && !defined(__clang__) +#if !defined(__clang__) && !defined(__EDG__) StlLikeContainer> stlLike; stlLike.assign(elementsArray.begin(), elementsArray.end()); for (auto&& x : stlLike) { @@ -114,7 +114,7 @@ void test_case_sequence_container() { } assert(!stlLike.beginCalled); assert(!stlLike.endCalled); -#endif // !defined(__EDG__) && !defined(__clang__) +#endif // !defined(__clang__) && !defined(__EDG__) } template