// { dg-do compile { target c++20 } } // { dg-additional-options "-fconcepts -fconcepts-diagnostics-depth=2" } // req9.C template concept same_as = __is_same(T, U); template struct S1 { }; template concept C = requires(T x) { { x.fn() } -> same_as>; }; 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|return-type-requirement" } struct B { }; class D : /*private*/ B { }; void driver_2() { static_assert(ConvertibleTo()); // { dg-error "cannot call" } static_assert(ConvertibleTo); // { dg-error "static assertion failed" } }