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