145
|
1 // { dg-do compile { target c++17_only } }
|
131
|
2 // { dg-options "-fconcepts" }
|
111
|
3
|
|
4 template<typename T>
|
145
|
5 concept bool Type = true;
|
|
6
|
|
7 template<typename T, typename U>
|
|
8 concept bool Same = __is_same_as(T, U);
|
111
|
9
|
|
10 template<typename T, typename U>
|
145
|
11 concept bool C1 = true;
|
|
12
|
|
13 template<typename T, typename... Args>
|
|
14 concept bool C2 = true;
|
111
|
15
|
|
16 template<typename T, typename U>
|
145
|
17 concept bool C3 = __is_same_as(T, int) && __is_same_as(U, double);
|
111
|
18
|
|
19 template<Same<int> T> struct S1 { };
|
|
20 template<typename T, Same<T> U> struct S2 { };
|
|
21
|
145
|
22 template<Same<int> Q>
|
|
23 void f(Q q) { }
|
|
24 template<Type A, Same<decltype(A{})> B>
|
|
25 void g(A a, B b) { }
|
111
|
26
|
145
|
27 template<Same<int> A>
|
|
28 void h0(A* a) { }
|
|
29 template<C1<int> A>
|
|
30 void h1(A* a) { }
|
|
31 template<C2<char, short, int, long> A>
|
|
32 void h2(A* a) { }
|
|
33 template<C3<double> A>
|
|
34 void h3(A* a) { }
|
111
|
35
|
|
36 int main() {
|
|
37 S1<int> s1;
|
|
38 S2<int, int> s2;
|
|
39 f(0);
|
|
40 g(0, 1);
|
|
41 h0((int*)0);
|
|
42 h1((int*)0);
|
145
|
43 // h2((int*)0);
|
|
44 h3((int*)0);
|
111
|
45 }
|