1 //===----------------------------------------------------------------------===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 9 // UNSUPPORTED: c++03, c++11, c++14, c++17 10 11 // template<class F, class... Args> 12 // concept equivalence_relation; 13 14 #include <concepts> 15 16 static_assert(std::equivalence_relation<bool(int, int), int, int>); 17 static_assert(std::equivalence_relation<bool(int, int), double, double>); 18 static_assert(std::equivalence_relation<bool(int, double), double, double>); 19 20 static_assert(!std::equivalence_relation<bool (*)(), int, double>); 21 static_assert(!std::equivalence_relation<bool (*)(int), int, double>); 22 static_assert(!std::equivalence_relation<bool (*)(double), int, double>); 23 24 static_assert( 25 !std::equivalence_relation<bool(double, double*), double, double*>); 26 static_assert(!std::equivalence_relation<bool(int&, int&), double&, double&>); 27 28 struct S1 {}; 29 static_assert(std::relation<bool (S1::*)(S1*), S1*, S1*>); 30 static_assert(std::relation<bool (S1::*)(S1&), S1&, S1&>); 31 32 struct S2 {}; 33 34 struct P1 { 35 bool operator()(S1, S1) const; 36 }; 37 static_assert(std::equivalence_relation<P1, S1, S1>); 38 39 struct P2 { 40 bool operator()(S1, S1) const; 41 bool operator()(S1, S2) const; 42 }; 43 static_assert(!std::equivalence_relation<P2, S1, S2>); 44 45 struct P3 { 46 bool operator()(S1, S1) const; 47 bool operator()(S1, S2) const; 48 bool operator()(S2, S1) const; 49 }; 50 static_assert(!std::equivalence_relation<P3, S1, S2>); 51 52 struct P4 { 53 bool operator()(S1, S1) const; 54 bool operator()(S1, S2) const; 55 bool operator()(S2, S1) const; 56 bool operator()(S2, S2) const; 57 }; 58 static_assert(std::equivalence_relation<P4, S1, S2>); 59