|
1 | 1 | // RUN: %clang_cc1 -std=c++20 -verify %s |
2 | 2 | // expected-no-diagnostics |
3 | 3 |
|
4 | | -template<typename T> |
5 | | -concept D = true; |
| 4 | +namespace Primary { |
| 5 | + template<typename T> |
| 6 | + concept D = true; |
6 | 7 |
|
7 | | -template<typename T> |
8 | | -struct A { |
9 | | - template<typename U, bool V> |
10 | | - void f() requires V; |
| 8 | + template<typename T> |
| 9 | + struct A { |
| 10 | + template<typename U, bool V> |
| 11 | + void f() requires V; |
11 | 12 |
|
12 | | - template<> |
13 | | - void f<short, true>(); |
| 13 | + template<> |
| 14 | + void f<short, true>(); |
| 15 | + |
| 16 | + template<D U> |
| 17 | + void g(); |
| 18 | + |
| 19 | + template<typename U, bool V> requires V |
| 20 | + struct B; |
| 21 | + |
| 22 | + template<typename U, bool V> requires V |
| 23 | + struct B<U*, V>; |
| 24 | + |
| 25 | + template<> |
| 26 | + struct B<short, true>; |
| 27 | + |
| 28 | + template<D U> |
| 29 | + struct C; |
| 30 | + |
| 31 | + template<D U> |
| 32 | + struct C<U*>; |
14 | 33 |
|
| 34 | + template<typename U, bool V> requires V |
| 35 | + static int x; |
| 36 | + |
| 37 | + template<typename U, bool V> requires V |
| 38 | + static int x<U*, V>; |
| 39 | + |
| 40 | + template<> |
| 41 | + int x<short, true>; |
| 42 | + |
| 43 | + template<D U> |
| 44 | + static int y; |
| 45 | + |
| 46 | + template<D U> |
| 47 | + static int y<U*>; |
| 48 | + }; |
| 49 | + |
| 50 | + template<typename T> |
| 51 | + template<typename U, bool V> |
| 52 | + void A<T>::f() requires V { } |
| 53 | + |
| 54 | + template<typename T> |
15 | 55 | template<D U> |
16 | | - void g(); |
| 56 | + void A<T>::g() { } |
17 | 57 |
|
| 58 | + template<typename T> |
18 | 59 | template<typename U, bool V> requires V |
19 | | - struct B; |
| 60 | + struct A<T>::B { }; |
20 | 61 |
|
| 62 | + template<typename T> |
21 | 63 | template<typename U, bool V> requires V |
22 | | - struct B<U*, V>; |
| 64 | + struct A<T>::B<U*, V> { }; |
23 | 65 |
|
24 | | - template<> |
25 | | - struct B<short, true>; |
| 66 | + template<typename T> |
| 67 | + template<typename U, bool V> requires V |
| 68 | + struct A<T>::B<U&, V> { }; |
26 | 69 |
|
| 70 | + template<typename T> |
27 | 71 | template<D U> |
28 | | - struct C; |
| 72 | + struct A<T>::C { }; |
29 | 73 |
|
| 74 | + template<typename T> |
30 | 75 | template<D U> |
31 | | - struct C<U*>; |
| 76 | + struct A<T>::C<U*> { }; |
32 | 77 |
|
| 78 | + template<typename T> |
33 | 79 | template<typename U, bool V> requires V |
34 | | - static int x; |
| 80 | + int A<T>::x = 0; |
35 | 81 |
|
| 82 | + template<typename T> |
36 | 83 | template<typename U, bool V> requires V |
37 | | - static int x<U*, V>; |
| 84 | + int A<T>::x<U*, V> = 0; |
38 | 85 |
|
39 | | - template<> |
40 | | - int x<short, true>; |
| 86 | + template<typename T> |
| 87 | + template<typename U, bool V> requires V |
| 88 | + int A<T>::x<U&, V> = 0; |
41 | 89 |
|
| 90 | + template<typename T> |
42 | 91 | template<D U> |
43 | | - static int y; |
| 92 | + int A<T>::y = 0; |
44 | 93 |
|
| 94 | + template<typename T> |
45 | 95 | template<D U> |
46 | | - static int y<U*>; |
47 | | -}; |
48 | | - |
49 | | -template<typename T> |
50 | | -template<typename U, bool V> |
51 | | -void A<T>::f() requires V { } |
| 96 | + int A<T>::y<U*> = 0; |
52 | 97 |
|
53 | | -template<typename T> |
54 | | -template<D U> |
55 | | -void A<T>::g() { } |
56 | | - |
57 | | -template<typename T> |
58 | | -template<typename U, bool V> requires V |
59 | | -struct A<T>::B { }; |
| 98 | + template<> |
| 99 | + template<typename U, bool V> |
| 100 | + void A<short>::f() requires V; |
60 | 101 |
|
61 | | -template<typename T> |
62 | | -template<typename U, bool V> requires V |
63 | | -struct A<T>::B<U*, V> { }; |
| 102 | + template<> |
| 103 | + template<> |
| 104 | + void A<short>::f<int, true>(); |
64 | 105 |
|
65 | | -template<typename T> |
66 | | -template<typename U, bool V> requires V |
67 | | -struct A<T>::B<U&, V> { }; |
| 106 | + template<> |
| 107 | + template<> |
| 108 | + void A<void>::f<int, true>(); |
68 | 109 |
|
69 | | -template<typename T> |
70 | | -template<D U> |
71 | | -struct A<T>::C { }; |
| 110 | + template<> |
| 111 | + template<D U> |
| 112 | + void A<short>::g(); |
72 | 113 |
|
73 | | -template<typename T> |
74 | | -template<D U> |
75 | | -struct A<T>::C<U*> { }; |
| 114 | + template<> |
| 115 | + template<typename U, bool V> requires V |
| 116 | + struct A<int>::B; |
76 | 117 |
|
77 | | -template<typename T> |
78 | | -template<typename U, bool V> requires V |
79 | | -int A<T>::x = 0; |
| 118 | + template<> |
| 119 | + template<> |
| 120 | + struct A<int>::B<int, true>; |
80 | 121 |
|
81 | | -template<typename T> |
82 | | -template<typename U, bool V> requires V |
83 | | -int A<T>::x<U*, V> = 0; |
| 122 | + template<> |
| 123 | + template<> |
| 124 | + struct A<void>::B<int, true>; |
84 | 125 |
|
85 | | -template<typename T> |
86 | | -template<typename U, bool V> requires V |
87 | | -int A<T>::x<U&, V> = 0; |
| 126 | + template<> |
| 127 | + template<typename U, bool V> requires V |
| 128 | + struct A<int>::B<U*, V>; |
88 | 129 |
|
89 | | -template<typename T> |
90 | | -template<D U> |
91 | | -int A<T>::y = 0; |
| 130 | + template<> |
| 131 | + template<typename U, bool V> requires V |
| 132 | + struct A<int>::B<U&, V>; |
92 | 133 |
|
93 | | -template<typename T> |
94 | | -template<D U> |
95 | | -int A<T>::y<U*> = 0; |
| 134 | + template<> |
| 135 | + template<D U> |
| 136 | + struct A<int>::C; |
96 | 137 |
|
97 | | -template<> |
98 | | -template<typename U, bool V> |
99 | | -void A<short>::f() requires V; |
| 138 | + template<> |
| 139 | + template<D U> |
| 140 | + struct A<int>::C<U*>; |
100 | 141 |
|
101 | | -template<> |
102 | | -template<> |
103 | | -void A<short>::f<int, true>(); |
| 142 | + template<> |
| 143 | + template<D U> |
| 144 | + struct A<int>::C<U&>; |
104 | 145 |
|
105 | | -template<> |
106 | | -template<> |
107 | | -void A<void>::f<int, true>(); |
| 146 | + template<> |
| 147 | + template<typename U, bool V> requires V |
| 148 | + int A<long>::x; |
108 | 149 |
|
109 | | -template<> |
110 | | -template<D U> |
111 | | -void A<short>::g(); |
| 150 | + template<> |
| 151 | + template<> |
| 152 | + int A<long>::x<int, true>; |
112 | 153 |
|
113 | | -template<> |
114 | | -template<typename U, bool V> requires V |
115 | | -struct A<int>::B; |
| 154 | + template<> |
| 155 | + template<> |
| 156 | + int A<void>::x<int, true>; |
116 | 157 |
|
117 | | -template<> |
118 | | -template<> |
119 | | -struct A<int>::B<int, true>; |
| 158 | + template<> |
| 159 | + template<typename U, bool V> requires V |
| 160 | + int A<long>::x<U*, V>; |
120 | 161 |
|
121 | | -template<> |
122 | | -template<> |
123 | | -struct A<void>::B<int, true>; |
| 162 | + template<> |
| 163 | + template<typename U, bool V> requires V |
| 164 | + int A<long>::x<U&, V>; |
124 | 165 |
|
125 | | -template<> |
126 | | -template<typename U, bool V> requires V |
127 | | -struct A<int>::B<U*, V>; |
| 166 | + template<> |
| 167 | + template<D U> |
| 168 | + int A<long>::y; |
128 | 169 |
|
129 | | -template<> |
130 | | -template<typename U, bool V> requires V |
131 | | -struct A<int>::B<U&, V>; |
| 170 | + template<> |
| 171 | + template<D U> |
| 172 | + int A<long>::y<U*>; |
132 | 173 |
|
133 | | -template<> |
134 | | -template<D U> |
135 | | -struct A<int>::C; |
| 174 | + template<> |
| 175 | + template<D U> |
| 176 | + int A<long>::y<U&>; |
| 177 | +} // namespace Primary |
136 | 178 |
|
137 | | -template<> |
138 | | -template<D U> |
139 | | -struct A<int>::C<U*>; |
| 179 | +namespace Partial { |
| 180 | + template<typename T, bool B> |
| 181 | + struct A; |
140 | 182 |
|
141 | | -template<> |
142 | | -template<D U> |
143 | | -struct A<int>::C<U&>; |
| 183 | + template<bool U> |
| 184 | + struct A<int, U> |
| 185 | + { |
| 186 | + template<typename V> requires U |
| 187 | + void f(); |
144 | 188 |
|
145 | | -template<> |
146 | | -template<typename U, bool V> requires V |
147 | | -int A<long>::x; |
| 189 | + template<typename V> requires U |
| 190 | + static const int x; |
148 | 191 |
|
149 | | -template<> |
150 | | -template<> |
151 | | -int A<long>::x<int, true>; |
| 192 | + template<typename V> requires U |
| 193 | + struct B; |
| 194 | + }; |
152 | 195 |
|
153 | | -template<> |
154 | | -template<> |
155 | | -int A<void>::x<int, true>; |
| 196 | + template<bool U> |
| 197 | + template<typename V> requires U |
| 198 | + void A<int, U>::f() { } |
156 | 199 |
|
157 | | -template<> |
158 | | -template<typename U, bool V> requires V |
159 | | -int A<long>::x<U*, V>; |
| 200 | + template<bool U> |
| 201 | + template<typename V> requires U |
| 202 | + constexpr int A<int, U>::x = 0; |
160 | 203 |
|
161 | | -template<> |
162 | | -template<typename U, bool V> requires V |
163 | | -int A<long>::x<U&, V>; |
| 204 | + template<bool U> |
| 205 | + template<typename V> requires U |
| 206 | + struct A<int, U>::B { }; |
164 | 207 |
|
165 | | -template<> |
166 | | -template<D U> |
167 | | -int A<long>::y; |
| 208 | + template<> |
| 209 | + template<typename V> requires true |
| 210 | + void A<int, true>::f() { } |
168 | 211 |
|
169 | | -template<> |
170 | | -template<D U> |
171 | | -int A<long>::y<U*>; |
| 212 | + template<> |
| 213 | + template<typename V> requires true |
| 214 | + constexpr int A<int, true>::x = 1; |
172 | 215 |
|
173 | | -template<> |
174 | | -template<D U> |
175 | | -int A<long>::y<U&>; |
| 216 | + template<> |
| 217 | + template<typename V> requires true |
| 218 | + struct A<int, true>::B { }; |
| 219 | +} // namespace Partial |
0 commit comments