File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -28,7 +28,9 @@ TEST_CASE("is_equal_comparable", "[extra_type_traits]") {
2828 static_assert (is_equal_comparable_v<comparable, comparable>);
2929 static_assert (!is_equal_comparable_v<non_comparable, non_comparable>);
3030 static_assert (is_equal_comparable_v<comparable, int >);
31- #if __cplusplus > 201703L && (!defined __GNUC__ || __GNUC__ >= 10)
31+ // C++20 rewritten candidates make 'int == comparable' valid via comparable::operator==(int). Clang defines
32+ // __GNUC__ as 4 yet supports this, so gate it in explicitly, alongside GCC>=10 and MSVC (which defines neither).
33+ #if __cplusplus > 201703L && (defined __clang__ || !defined __GNUC__ || __GNUC__ >= 10)
3234 static_assert (is_equal_comparable_v<int , comparable>);
3335#else
3436 static_assert (!is_equal_comparable_v<int , comparable>);
Original file line number Diff line number Diff line change @@ -12,7 +12,10 @@ namespace detail {
1212 {
1313 if constexpr (std::is_same_v<bool , decltype (f.template operator ()<First>())>)
1414 {
15- constexpr bool proceed = f.template operator ()<First>();
15+ // 'f' is a function parameter, not a constant expression: calling it here is non-portable (Apple
16+ // Clang rejects f.operator()<First>() in this constexpr context). A captureless closure is
17+ // default-constructible in C++20, so a fresh value-initialized one gives a genuine constant.
18+ constexpr bool proceed = decltype (f){}.template operator ()<First>();
1619 if constexpr (proceed)
1720 consteval_for_T<T, First + 1 , Last>(f);
1821 }
You can’t perform that action at this time.
0 commit comments