// { dg-do compile { target c++20 } } template concept same_as = __is_same_as(T,U); template concept C1 = requires (T& t) { // { dg-message "in requirements" } t.~T(); }; template concept C2 = requires (T& t) { // { dg-message "in requirements" } { t.~T() } -> same_as; }; template concept C3 = requires { // { dg-message "in requirements" } typename T::type; }; class S1 { ~S1() { } using type = int; }; void driver() { static_assert(C1, ""); // { dg-error "static assertion failed" } static_assert(C2, ""); // { dg-error "static assertion failed" } static_assert(C3, ""); // { dg-error "static assertion failed" } } template requires C1 void f1() { } template requires C2 void f2() { } template requires C3 void f3() { } void driver2() { f1(); // { dg-error "no match" } f2(); // { dg-error "no match" } f3(); // { dg-error "no match" } }