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