1 // { dg-do compile { target c++17 } } 2 // { dg-options "-fconcepts" } 3 4 template<typename T> C()5 concept bool C() { return __is_class(T); } 6 7 template<typename T> D()8 concept bool D() { return C<T>() && __is_empty(T); } 9 10 struct X { }; 11 struct Y { int n; }; 12 f1S13template<typename T> struct S { void f1() { } }; // #1 14 template<C T> struct S<T> { void f2() { } }; // #2 15 template<D T> struct S<T> { void f3() { } }; // #3 16 17 template struct S<int>; // Instantiate #1 18 template struct S<X>; // Instantiate #2 19 template struct S<Y>; // Instantiate #2 20 21 int main() { 22 S<int> i; i.f1(); 23 S<X> x; x.f3(); 24 S<Y> y; y.f2(); 25 } 26