//===----------------------------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // UNSUPPORTED: c++03, c++11, c++14, c++17 // template // concept predicate; #include #include static_assert(std::predicate); static_assert(std::predicate); static_assert(std::predicate); static_assert(!std::predicate); static_assert(!std::predicate); static_assert(!std::predicate); struct S {}; static_assert(!std::predicate); static_assert(!std::predicate); static_assert(std::predicate); static_assert(std::predicate); static_assert(std::predicate); static_assert(!std::predicate); static_assert(!std::predicate); static_assert(!std::predicate); static_assert(!std::predicate); static_assert(!std::predicate); static_assert(std::predicate); struct Predicate { bool operator()(int, double, char); }; static_assert(std::predicate); static_assert(std::predicate); static_assert(!std::predicate); static_assert(!std::predicate); constexpr bool check_lambda(auto) { return false; } constexpr bool check_lambda(std::predicate auto) { return true; } static_assert(check_lambda([] { return std::true_type(); })); static_assert(check_lambda([]() -> int* { return nullptr; })); struct boolean { operator bool() const noexcept; }; static_assert(check_lambda([] { return boolean(); })); struct explicit_bool { explicit operator bool() const noexcept; }; static_assert(!check_lambda([] { return explicit_bool(); }));