1 // PR c++/82565 2 // { dg-do compile { target c++14 } } 3 // { dg-additional-options -fconcepts } 4 5 struct string 6 { 7 string(); 8 string(const char *); 9 bool empty() const; 10 }; 11 12 template<typename T, typename ReturnType> Concept()13concept bool Concept() { 14 return requires(T t, const string& s) { 15 { t(s) } -> ReturnType; 16 }; 17 } 18 19 struct test { 20 string _str; 21 22 template<typename Visitor> 23 requires Concept<Visitor, bool>() decltypetest24 decltype(auto) visit(Visitor&& visitor) const { 25 return visitor(_str); 26 } 27 28 }; 29 main()30int main() { 31 test().visit([] (auto& x) { return x.empty(); }); 32 } 33