131
|
1 // { dg-do compile { target c++17 } }
|
|
2 // { dg-options "-fconcepts" }
|
111
|
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>
|
|
15 concept bool D1()
|
|
16 {
|
|
17 return requires (T t) { { t } -> C1; };
|
|
18 }
|
|
19
|
|
20 template<typename T>
|
|
21 concept bool D2()
|
|
22 {
|
|
23 return requires (T t) { { t } -> C2<void>; };
|
|
24 }
|
|
25
|
|
26 void f1(D1) { }
|
|
27 void f2(D2) { }
|
|
28
|
|
29 int main()
|
|
30 {
|
|
31 f1(0); // { dg-error "cannot call" }
|
|
32 f2(0); // { dg-error "cannot call" }
|
|
33 }
|