| 1 |
// DR 1286 |
| 2 |
// { dg-do compile { target c++11 } } |
| 3 |
|
| 4 |
template <class,class> struct same; |
| 5 |
template <class T> struct same<T,T> {}; |
| 6 |
|
| 7 |
template <class,class> struct different {}; |
| 8 |
template <class T> struct different<T,T>; |
| 9 |
|
| 10 |
template<typename T, typename U = T> struct A; |
| 11 |
template<template <class...> class> struct X; |
| 12 |
|
| 13 |
// equivalent to A |
| 14 |
template<typename V, typename W = V> |
| 15 |
using B = A<V, W>; |
| 16 |
|
| 17 |
same<X<A>,X<B>> s1; |
| 18 |
|
| 19 |
// not equivalent to A: not all parameters used |
| 20 |
template<typename V, typename W = V> |
| 21 |
using C = A<V>; |
| 22 |
|
| 23 |
different<X<A>,X<C>> d1; |
| 24 |
|
| 25 |
// not equivalent to A: different number of parameters |
| 26 |
template<typename V> |
| 27 |
using D = A<V>; |
| 28 |
|
| 29 |
different<X<A>,X<D>> d2; |
| 30 |
|
| 31 |
// not equivalent to A: template-arguments in wrong order |
| 32 |
template<typename V, typename W = V> |
| 33 |
using E = A<W, V>; |
| 34 |
|
| 35 |
different<X<A>,X<E>> d3; |
| 36 |
|
| 37 |
// NOT equivalent to A: default arguments now considered |
| 38 |
template<typename V, typename W = int> |
| 39 |
using F = A<V, W>; |
| 40 |
|
| 41 |
different<X<A>,X<F>> s2; |
| 42 |
|
| 43 |
// equivalent to A and B |
| 44 |
template<typename V, typename W = V> |
| 45 |
using G = A<V, W>; |
| 46 |
|
| 47 |
same<X<A>,X<G>> s3; |
| 48 |
same<X<B>,X<G>> s3b; |
| 49 |
|
| 50 |
// equivalent to E |
| 51 |
template<typename V, typename W = V> |
| 52 |
using H = E<V, W>; |
| 53 |
|
| 54 |
same<X<E>,X<H>> s4; |
| 55 |
|
| 56 |
// not equivalent to A: argument not identifier |
| 57 |
template<typename V, typename W = V> |
| 58 |
using I = A<V, typename W::type>; |
| 59 |
|
| 60 |
different<X<A>,X<I>> d4; |