// { dg-do compile { target c++2a } } // { dg-additional-options "-fconcepts-ts -fconcepts-diagnostics-depth=2" } // Test conversion requirements (not in C++20) // req9.C template struct S1 { }; template concept C = requires(T x) { { x.fn() } -> S1; }; template requires C void fn(U x) { x.fn(); } struct S2 { auto fn() const { return S1(); } }; int driver_1() { fn(S2{}); return 0; } // req10.C // Test implicit conversion requirements template concept ConvertibleTo = requires(T& t) { {t} -> U&; }; // { dg-error "inaccessible" } struct B { }; class D : /*private*/ B { }; void driver_2() { static_assert(ConvertibleTo()); // { dg-error "cannot call" } static_assert(ConvertibleTo); // { dg-error "static assertion failed" } }