| 1 |
// PR c++/69958 |
| 2 |
// { dg-do compile { target c++11 } } |
| 3 |
|
| 4 |
typedef decltype(sizeof(int)) size_t; |
| 5 |
|
| 6 |
template <typename...Ts> |
| 7 |
struct list { }; |
| 8 |
|
| 9 |
template <size_t N> |
| 10 |
struct size { }; |
| 11 |
|
| 12 |
template <typename...Ts> |
| 13 |
using size_for = size<sizeof...(Ts)>; |
| 14 |
|
| 15 |
template<class T, class U> struct assert_same; |
| 16 |
template<class T> struct assert_same<T,T> {}; |
| 17 |
|
| 18 |
template <typename T, typename...Ts> |
| 19 |
using wrapped = list<T, size_for<T, Ts...>>; |
| 20 |
|
| 21 |
// This assertion fails (produces size<4>) |
| 22 |
assert_same< |
| 23 |
list<float, size<5>>, |
| 24 |
wrapped<float, int, double, char, unsigned>> a3; |
| 25 |
|
| 26 |
|
| 27 |
template <typename T, typename...Ts> |
| 28 |
using wrapped2 = list<T, size_for<Ts..., T>>; |
| 29 |
|
| 30 |
// This assertion fails (produces size<2>) |
| 31 |
assert_same< |
| 32 |
list<float, size<5>>, |
| 33 |
wrapped2<float, int, double, char, unsigned>> a4; |