Debian Codegraph @

gcc/testsuite/g++.dg/concepts/partial-concept-id1.C

raw
1 // { dg-do compile { target c++17 } }
2 // { dg-options "-fconcepts" }
3
4 template<typename T>
5 concept Type = true;
6
7 template<typename T, typename U>
8 concept Same = __is_same_as(T, U);
9
10 template<typename T, typename U>
11 concept C1 = true;
12
13 template<typename T, typename... Args>
14 concept C2 = true;
15
16 template<typename T, typename U>
17 concept C3 = __is_same_as(T, int) && __is_same_as(U, double);
18
19 template<Same<int> T> struct S1 { };
20 template<typename T, Same<T> U> struct S2 { };
21
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) { }
26
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) { }
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);
43 // h2((int*)0);
44 h3((int*)0);
45 }