brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.7 KiB · 98d73fc Raw
57 lines · cpp
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-exception6//7//===----------------------------------------------------------------------===//8 9// UNSUPPORTED: c++03, c++11, c++14, c++1710 11// template<class F, class... Args>12// concept relation;13 14#include <concepts>15 16static_assert(std::relation<bool(int, int), int, int>);17static_assert(std::relation<bool(int, int), double, double>);18static_assert(std::relation<bool(int, double), double, double>);19 20static_assert(!std::relation<bool(), int, double>);21static_assert(!std::relation<bool(int), int, double>);22static_assert(!std::relation<bool(double), int, double>);23static_assert(!std::relation<bool(double, double*), double, double*>);24static_assert(!std::relation<bool(int&, int&), double&, double&>);25 26struct S1 {};27static_assert(std::relation<bool (S1::*)(S1*), S1*, S1*>);28static_assert(std::relation<bool (S1::*)(S1&), S1&, S1&>);29 30struct S2 {};31 32struct P1 {33  bool operator()(S1, S1) const;34};35static_assert(std::relation<P1, S1, S1>);36 37struct P2 {38  bool operator()(S1, S1) const;39  bool operator()(S1, S2) const;40};41static_assert(!std::relation<P2, S1, S2>);42 43struct P3 {44  bool operator()(S1, S1) const;45  bool operator()(S1, S2) const;46  bool operator()(S2, S1) const;47};48static_assert(!std::relation<P3, S1, S2>);49 50struct 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};56static_assert(std::relation<P4, S1, S2>);57