// { dg-do run } // { dg-options "-std=c++1z" } #include template concept bool C() { return __is_class(T); } template concept bool D() { return C() && __is_empty(T); } struct X { } x; struct Y { int n; } y; int called = 0; template struct S { void f() { called = 0; } // #1 void f() requires C() { called = 0; } // #2 void g() requires C() { } // #1 void g() requires D() { } // #2 }; template<> void S::f() { called = 1; } // Spec of #1 template<> void S::f() { called = 2; } // Spec of #2 template<> void S::g() { called = 3; } // Spec of #2 template<> void S::g() { called = 4; } // Spec of #1 int main() { S sd; S si; S sx; S sy; sd.f(); assert(called == 0); si.f(); assert(called == 1); sx.f(); assert(called == 2); sy.f(); assert(called == 0); sx.g(); assert(called == 3); sy.g(); assert(called == 4); }