From 086a78a86cb155ddec2c5b615bcf0918bd026260 Mon Sep 17 00:00:00 2001 From: Daniel Marshall Date: Thu, 21 May 2020 14:37:50 +0100 Subject: [PATCH 1/6] Partially address GH-741 --- .../P0896R4_P1614R2_comparisons/test.cpp | 28 ++++++++----------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/tests/std/tests/P0896R4_P1614R2_comparisons/test.cpp b/tests/std/tests/P0896R4_P1614R2_comparisons/test.cpp index 14cf382b110..3ce5dbe885b 100644 --- a/tests/std/tests/P0896R4_P1614R2_comparisons/test.cpp +++ b/tests/std/tests/P0896R4_P1614R2_comparisons/test.cpp @@ -254,12 +254,13 @@ constexpr bool test_compare_three_way() { enum class some_enum { value }; -#if defined(__clang__) || defined(__EDG__) // TRANSITION, VSO-905257 STATIC_ASSERT(test_compare_three_way()); STATIC_ASSERT(test_compare_three_way()); STATIC_ASSERT(test_compare_three_way()); STATIC_ASSERT(test_compare_three_way()); +#if defined(__clang__) || defined(__EDG__) // TRANSITION, GH-741 STATIC_ASSERT(test_compare_three_way()); +#endif // TRANSITION, GH-741 STATIC_ASSERT(test_compare_three_way()); STATIC_ASSERT(test_compare_three_way()); @@ -270,7 +271,6 @@ STATIC_ASSERT(test_compare_three_way()); STATIC_ASSERT(test_compare_three_way()); STATIC_ASSERT(test_compare_three_way()); -#endif // TRANSITION, VSO-905257 template struct compares_as {}; @@ -294,17 +294,8 @@ STATIC_ASSERT(test_compare_three_way, compares_as -constexpr void assert_three_way(T const& t, U const& u, R const result) { // TRANSITION, VSO-905257 -#if !defined(__clang__) && !defined(__EDG__) - // <=> expressions that resolve to builtin operators are incorrectly lvalues of const-qualified type on MSVC, so - // they are rejected by std::three_way_comparable and std::three_way_comparable_with. - if constexpr (!std::is_class_v> && !std::is_class_v>) { - return; - } else -#endif // !defined(__clang__) && !defined(__EDG__) - { - assert(compare_three_way{}(t, u) == result); - } +constexpr void assert_three_way(T const& t, U const& u, R const result) { + assert(compare_three_way{}(t, u) == result); } template @@ -465,9 +456,14 @@ constexpr void ordering_test_cases() { test_partially_ordered(1.414f, 3.14, partial_ordering::less); test_partially_ordered(1.414, 3.14f, partial_ordering::less); test_partially_ordered(31.625f, 31.625, partial_ordering::equivalent); - test_partially_ordered(3.14, NaN, partial_ordering::unordered); - test_partially_ordered(3.14f, NaN, partial_ordering::unordered); - test_partially_ordered(3.14, NaNf, partial_ordering::unordered); +#if !defined(__clang__) && !defined(__EDG__) // TRANSITION, GH-741 + if (!std::is_constant_evaluated()) +#endif // TRANSITION, GH-741 + { + test_partially_ordered(3.14, NaN, partial_ordering::unordered); + test_partially_ordered(3.14f, NaN, partial_ordering::unordered); + test_partially_ordered(3.14, NaNf, partial_ordering::unordered); + } // Validate types with no builtin <=> operators that are nonetheless totally_ordered (within a // limited domain) or equality_comparable From 39665387827c76226d3c0e0844052eebb21a8acc Mon Sep 17 00:00:00 2001 From: Daniel Marshall Date: Fri, 22 May 2020 07:57:32 +0100 Subject: [PATCH 2/6] Update transition comments Co-authored-by: Casey Carter --- tests/std/tests/P0896R4_P1614R2_comparisons/test.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/std/tests/P0896R4_P1614R2_comparisons/test.cpp b/tests/std/tests/P0896R4_P1614R2_comparisons/test.cpp index 3ce5dbe885b..bb29fe1c990 100644 --- a/tests/std/tests/P0896R4_P1614R2_comparisons/test.cpp +++ b/tests/std/tests/P0896R4_P1614R2_comparisons/test.cpp @@ -258,9 +258,9 @@ STATIC_ASSERT(test_compare_three_way()); STATIC_ASSERT(test_compare_three_way()); STATIC_ASSERT(test_compare_three_way()); STATIC_ASSERT(test_compare_three_way()); -#if defined(__clang__) || defined(__EDG__) // TRANSITION, GH-741 +#if defined(__clang__) || defined(__EDG__) // TRANSITION, DevCom-1044530 STATIC_ASSERT(test_compare_three_way()); -#endif // TRANSITION, GH-741 +#endif // TRANSITION, DevCom-1044530 STATIC_ASSERT(test_compare_three_way()); STATIC_ASSERT(test_compare_three_way()); @@ -456,9 +456,9 @@ constexpr void ordering_test_cases() { test_partially_ordered(1.414f, 3.14, partial_ordering::less); test_partially_ordered(1.414, 3.14f, partial_ordering::less); test_partially_ordered(31.625f, 31.625, partial_ordering::equivalent); -#if !defined(__clang__) && !defined(__EDG__) // TRANSITION, GH-741 +#if !defined(__clang__) && !defined(__EDG__) // TRANSITION, VSO-1062601 if (!std::is_constant_evaluated()) -#endif // TRANSITION, GH-741 +#endif // TRANSITION, VSO-1062601 { test_partially_ordered(3.14, NaN, partial_ordering::unordered); test_partially_ordered(3.14f, NaN, partial_ordering::unordered); From d9ba12c60feda1f31606d0b0f7162f0a31f4d8e5 Mon Sep 17 00:00:00 2001 From: Daniel Marshall Date: Fri, 22 May 2020 08:00:59 +0100 Subject: [PATCH 3/6] Change template to macro --- tests/std/tests/P0896R4_P1614R2_comparisons/test.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tests/std/tests/P0896R4_P1614R2_comparisons/test.cpp b/tests/std/tests/P0896R4_P1614R2_comparisons/test.cpp index bb29fe1c990..58ff9e48f97 100644 --- a/tests/std/tests/P0896R4_P1614R2_comparisons/test.cpp +++ b/tests/std/tests/P0896R4_P1614R2_comparisons/test.cpp @@ -293,10 +293,7 @@ STATIC_ASSERT(test_compare_three_way, compares_as -constexpr void assert_three_way(T const& t, U const& u, R const result) { - assert(compare_three_way{}(t, u) == result); -} +#define assert_three_way(t, u, result) assert((compare_three_way{}(t, u) == result) template constexpr void test_equality_comparable(T const& t, U const& u, strong_ordering const o) { From fe4ab779a815107fb64dc6f6b1ae769655564a11 Mon Sep 17 00:00:00 2001 From: Daniel Marshall Date: Fri, 22 May 2020 08:07:54 +0100 Subject: [PATCH 4/6] Missing ) --- tests/std/tests/P0896R4_P1614R2_comparisons/test.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/std/tests/P0896R4_P1614R2_comparisons/test.cpp b/tests/std/tests/P0896R4_P1614R2_comparisons/test.cpp index 58ff9e48f97..b17573eac53 100644 --- a/tests/std/tests/P0896R4_P1614R2_comparisons/test.cpp +++ b/tests/std/tests/P0896R4_P1614R2_comparisons/test.cpp @@ -293,7 +293,7 @@ STATIC_ASSERT(test_compare_three_way, compares_as constexpr void test_equality_comparable(T const& t, U const& u, strong_ordering const o) { From c7b99803586a6dc1c0dfbf248eea214127c4df29 Mon Sep 17 00:00:00 2001 From: Casey Carter Date: Sun, 24 May 2020 06:32:05 -0700 Subject: [PATCH 5/6] VSO-1070391 is also fixed --- tests/std/tests/P0896R4_P1614R2_comparisons/test.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/std/tests/P0896R4_P1614R2_comparisons/test.cpp b/tests/std/tests/P0896R4_P1614R2_comparisons/test.cpp index b17573eac53..7a052c0aaf9 100644 --- a/tests/std/tests/P0896R4_P1614R2_comparisons/test.cpp +++ b/tests/std/tests/P0896R4_P1614R2_comparisons/test.cpp @@ -492,9 +492,7 @@ constexpr void ordering_test_cases() { } }; test_equality_comparable(&has_members::x, &has_members::y, strong_ordering::less); // Ditto "not equal" -#if defined(__clang__) || defined(__EDG__) // TRANSITION, VSO-1070391 test_equality_comparable(&has_members::f, &has_members::g, strong_ordering::less); // Ditto "not equal" -#endif // TRANSITION, VSO-1070391 test_equality_comparable(nullptr, nullptr, strong_ordering::equal); From 4960f9258425ca572a27b0340f9a18256333adaa Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Tue, 23 Jun 2020 13:23:05 -0700 Subject: [PATCH 6/6] Refine assert_three_way macro. --- tests/std/tests/P0896R4_P1614R2_comparisons/test.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/std/tests/P0896R4_P1614R2_comparisons/test.cpp b/tests/std/tests/P0896R4_P1614R2_comparisons/test.cpp index 7a052c0aaf9..04593749741 100644 --- a/tests/std/tests/P0896R4_P1614R2_comparisons/test.cpp +++ b/tests/std/tests/P0896R4_P1614R2_comparisons/test.cpp @@ -293,7 +293,7 @@ STATIC_ASSERT(test_compare_three_way, compares_as constexpr void test_equality_comparable(T const& t, U const& u, strong_ordering const o) {