Skip to content

Commit 57b1315

Browse files
committed
Fix [diff.cpp20.concepts] check
1 parent 02ed7c6 commit 57b1315

File tree

2 files changed

+5
-14
lines changed

2 files changed

+5
-14
lines changed

llvm-project

tests/std/tests/P2404R3_move_only_types_for_comparison_concepts/test.compile.pass.cpp

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -38,25 +38,16 @@ static_assert(totally_ordered_with<int, MoveOnly>);
3838
// clang-format off
3939
template <class T, class U>
4040
requires equality_comparable_with<T, U>
41-
bool attempted_equals(const T&, const U& u);
41+
bool attempted_equals(const T&, const U& u); // not defined
4242

4343
template <class T, class U>
4444
requires common_reference_with<const remove_reference_t<T>&, const remove_reference_t<U>&>
45-
bool attempted_equals(const T& t, const U& u);
45+
bool attempted_equals(const T& t, const U& u); // not defined
4646
// clang-format on
4747

4848
template <class T>
49-
bool test(T val) {
50-
return attempted_equals(val, nullptr); // ill-formed; previously well-formed
51-
}
49+
constexpr bool check_diff_cpp20_concepts = !requires(T p) { attempted_equals(p, nullptr); };
5250

53-
template <class T>
54-
constexpr bool diff_cpp20_concepts = requires(T val) { test(val); };
55-
56-
#if _HAS_CXX23
57-
static_assert(!diff_cpp20_concepts<unique_ptr<int>>);
58-
#else // ^^^ C++23 / C++20 vvv
59-
static_assert(diff_cpp20_concepts<unique_ptr<int>>);
60-
#endif // C++20
51+
static_assert(check_diff_cpp20_concepts<shared_ptr<int>>);
6152

6253
int main() {} // COMPILE-ONLY

0 commit comments

Comments
 (0)