| 1 |
// PR c++/63139 |
| 2 |
// { dg-do compile { target c++11 } } |
| 3 |
|
| 4 |
template<typename ...T> |
| 5 |
struct type_list {}; |
| 6 |
|
| 7 |
template<typename ...T> |
| 8 |
struct make_type_list |
| 9 |
{ |
| 10 |
using type = type_list<T...>; |
| 11 |
}; |
| 12 |
|
| 13 |
// The bug disappears if you use make_type_list directly. |
| 14 |
template<typename ...T> |
| 15 |
using make_type_list_t = typename make_type_list<T...>::type; |
| 16 |
|
| 17 |
|
| 18 |
struct ContainerEndA {}; |
| 19 |
|
| 20 |
template<typename ...Ts> |
| 21 |
struct ContainerA |
| 22 |
{ |
| 23 |
using type = make_type_list_t<Ts..., ContainerEndA>; |
| 24 |
}; |
| 25 |
|
| 26 |
|
| 27 |
struct ContainerEndB {}; |
| 28 |
|
| 29 |
template<typename ...Ts> |
| 30 |
struct ContainerB |
| 31 |
{ |
| 32 |
using type = make_type_list_t<Ts..., ContainerEndB>; |
| 33 |
}; |
| 34 |
|
| 35 |
template<typename T, typename U> |
| 36 |
struct is_same |
| 37 |
{ |
| 38 |
static const bool value = false; |
| 39 |
}; |
| 40 |
|
| 41 |
template<typename T> |
| 42 |
struct is_same<T, T> |
| 43 |
{ |
| 44 |
static const bool value = true; |
| 45 |
}; |
| 46 |
|
| 47 |
#define SA(X) static_assert((X), #X) |
| 48 |
|
| 49 |
SA((is_same<ContainerB<>::type, type_list<ContainerEndB>>::value)); |
| 50 |
SA((!is_same<ContainerA<>::type, type_list<ContainerEndB>>::value)); |
| 51 |
SA((!is_same<ContainerA<>::type, ContainerB<>::type>::value)); |