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 relation; 13 14 #include <concepts> 15 16 static_assert(std::relation<bool(int, int), int, int>); 17 static_assert(std::relation<bool(int, int), double, double>); 18 static_assert(std::relation<bool(int, double), double, double>); 19 20 static_assert(!std::relation<bool(), int, double>); 21 static_assert(!std::relation<bool(int), int, double>); 22 static_assert(!std::relation<bool(double), int, double>); 23 static_assert(!std::relation<bool(double, double*), double, double*>); 24 static_assert(!std::relation<bool(int&, int&), double&, double&>); 25 26 struct S1 {}; 27 static_assert(std::relation<bool (S1::*)(S1*), S1*, S1*>); 28 static_assert(std::relation<bool (S1::*)(S1&), S1&, S1&>); 29 30 struct S2 {}; 31 32 struct P1 { 33 bool operator()(S1, S1) const; 34 }; 35 static_assert(std::relation<P1, S1, S1>); 36 37 struct P2 { 38 bool operator()(S1, S1) const; 39 bool operator()(S1, S2) const; 40 }; 41 static_assert(!std::relation<P2, S1, S2>); 42 43 struct P3 { 44 bool operator()(S1, S1) const; 45 bool operator()(S1, S2) const; 46 bool operator()(S2, S1) const; 47 }; 48 static_assert(!std::relation<P3, S1, S2>); 49 50 struct P4 { 51 bool operator()(S1, S1) const; 52 bool operator()(S1, S2) const; 53 bool operator()(S2, S1) const; 54 bool operator()(S2, S2) const; 55 }; 56 static_assert(std::relation<P4, S1, S2>); 57