@@ -200,8 +200,120 @@ namespace consistency {
200
200
template struct A <B<int >, B<int >, B<int >>;
201
201
// new-error@-1 {{ambiguous partial specializations}}
202
202
} // namespace t2
203
+ namespace t3 {
204
+ template <class T1 , class T2 , class T3 > struct A ;
205
+
206
+ template <template <class , class > class TT1 ,
207
+ class T1 , class T2 , class T3 , class T4 >
208
+ struct A <TT1<T1, T2>, TT1<T3, T4>, typename nondeduced<TT1<T1, T2>>::type> {};
209
+ // new-note@-1 {{partial specialization matches}}
210
+
211
+ template <template <class > class UU1 ,
212
+ class U1 , class U2 >
213
+ struct A <UU1<U1>, UU1<U2>, typename nondeduced<UU1<U1>>::type>;
214
+ // new-note@-1 {{partial specialization matches}}
215
+
216
+ template struct A <B<int >, B<int >, B<int >>;
217
+ // new-error@-1 {{ambiguous partial specializations}}
218
+ } // namespace t3
219
+ namespace t4 {
220
+ template <class T1 , class T2 , class T3 > struct A ;
221
+
222
+ template <template <class , class > class TT1 ,
223
+ class T1 , class T2 , class T3 , class T4 >
224
+ struct A <TT1<T1, T2>, TT1<T3, T4>, typename nondeduced<TT1<T1, T4>>::type> {};
225
+ // new-note@-1 {{partial specialization matches}}
226
+
227
+ template <template <class > class UU1 ,
228
+ class U1 , class U2 >
229
+ struct A <UU1<U1>, UU1<U2>, typename nondeduced<UU1<U1>>::type>;
230
+ // new-note@-1 {{partial specialization matches}}
231
+
232
+ template struct A <B<int >, B<int >, B<int >>;
233
+ // new-error@-1 {{ambiguous partial specializations}}
234
+ } // namespace t4
235
+ namespace t5 {
236
+ template <class T1 , class T2 > struct A ;
237
+
238
+ template <template <class , class > class TT1 ,
239
+ class T1 , class T2 , class T3 , class T4 >
240
+ struct A <TT1<T1, T2>, TT1<T3, T4>> {};
241
+ // new-note@-1 {{partial specialization matches}}
242
+
243
+ template <template <class > class UU1 ,
244
+ class U1 , class U2 >
245
+ struct A <UU1<U1>, UU1<U2>>;
246
+ // new-note@-1 {{partial specialization matches}}
247
+
248
+ template struct A <B<int >, B<int >>;
249
+ // new-error@-1 {{ambiguous partial specializations}}
250
+ } // namespace t5
251
+ namespace t6 {
252
+ template <class T1 , class T2 > struct A ;
253
+
254
+ template <template <class , class > class TT1 ,
255
+ class T1 , class T2 , class T3 >
256
+ struct A <TT1<T1, T2>, TT1<T1, T3>> {};
257
+ // new-note@-1 {{partial specialization matches}}
258
+
259
+ template <template <class > class UU1 ,
260
+ class U1 , class U2 >
261
+ struct A <UU1<U1>, UU1<U2>>;
262
+ // new-note@-1 {{partial specialization matches}}
263
+
264
+ template struct A <B<int >, B<int >>;
265
+ // new-error@-1 {{ambiguous partial specializations}}
266
+ } // namespace t6
203
267
} // namespace consistency
204
268
269
+ namespace classes {
270
+ namespace canon {
271
+ template <class T , class U > struct A {};
272
+
273
+ template <template <class > class TT > auto f (TT<int > a) { return a; }
274
+ // old-note@-1 2{{template template argument has different template parameters}}
275
+ // new-note@-2 2{{substitution failure: too few template arguments}}
276
+
277
+ A<int , float > v1;
278
+ A<int , double > v2;
279
+
280
+ using X = decltype(f(v1));
281
+ // expected-error@-1 {{no matching function for call}}
282
+
283
+ using X = decltype(f(v2));
284
+ // expected-error@-1 {{no matching function for call}}
285
+ } // namespace canon
286
+ namespace expr {
287
+ template <class T1 , int E1 > struct A {
288
+ static constexpr auto val = E1 ;
289
+ };
290
+ template <template <class T3 > class TT > void f (TT<int > v) {
291
+ // old-note@-1 {{template template argument has different template parameters}}
292
+ // new-note@-2 {{substitution failure: too few template arguments}}
293
+ static_assert (v.val == 3 );
294
+ };
295
+ void test () {
296
+ f (A<int , 3 >());
297
+ // expected-error@-1 {{no matching function for call}}
298
+ }
299
+ } // namespace expr
300
+ namespace packs {
301
+ template <class T1 , class ...T2s> struct A {
302
+ static constexpr auto val = sizeof ...(T2s);
303
+ };
304
+
305
+ template <template <class T3 > class TT > void f (TT<int > v) {
306
+ // old-note@-1 {{template template argument has different template parameters}}
307
+ // new-note@-2 {{deduced type 'A<[...], (no argument), (no argument), (no argument)>' of 1st parameter does not match adjusted type 'A<[...], void, void, void>' of argument [with TT = A]}}
308
+ static_assert (v.val == 3 );
309
+ };
310
+ void test () {
311
+ f (A<int , void , void , void >());
312
+ // expected-error@-1 {{no matching function for call}}
313
+ }
314
+ } // namespace packs
315
+ } // namespace classes
316
+
205
317
namespace regression1 {
206
318
template <typename T, typename Y> struct map {};
207
319
template <typename T> class foo {};
0 commit comments