1 // { dg-do compile { target c++17 } } 2 // { dg-options "-fconcepts" } 3 4 // Check argument deduction constraints. 5 // TODO: We shoul have more of these... 6 7 template<typename T> 8 concept bool C1 = sizeof(T) == 0; 9 10 template<typename T, typename U> 11 concept bool C2 = __is_same_as(T, U); 12 13 14 template<typename T> D1()15concept bool D1() 16 { 17 return requires (T t) { { t } -> C1; }; 18 } 19 20 template<typename T> D2()21concept bool D2() 22 { 23 return requires (T t) { { t } -> C2<void>; }; 24 } 25 f1(D1)26void f1(D1) { } f2(D2)27void f2(D2) { } 28 main()29int main() 30 { 31 f1(0); // { dg-error "cannot call" } 32 f2(0); // { dg-error "cannot call" } 33 } 34