Mercurial > hg > CbC > CbC_gcc
view gcc/testsuite/g++.dg/cpp2a/concepts-lambda1.C @ 145:1830386684a0
gcc-9.2.0
author | anatofuz |
---|---|
date | Thu, 13 Feb 2020 11:34:05 +0900 |
parents | |
children |
line wrap: on
line source
// PR c++/82565 // { dg-do compile { target c++2a } } struct string { string(); string(const char *); bool empty() const; }; template<class From, class To> concept convertible_to = requires(From (&f)(), void (&g)(To)) { g(f()); }; template<typename T, typename ReturnType> concept Concept = requires(T t, const string& s) { { t(s) } -> convertible_to<ReturnType>; }; struct test { string _str; template<typename Visitor> requires Concept<Visitor, bool> decltype(auto) visit(Visitor&& visitor) const { return visitor(_str); } }; int main() { test().visit([] (auto& x) { return x.empty(); }); }