| 1 |
// PR c++/65790 |
| 2 |
// { dg-do compile { target c++11 } } |
| 3 |
|
| 4 |
extern "C" int printf(const char*, ...); |
| 5 |
|
| 6 |
namespace std |
| 7 |
{ |
| 8 |
typedef decltype(sizeof(0)) size_t; |
| 9 |
|
| 10 |
template<typename _Tp, _Tp... _Idx> |
| 11 |
struct integer_sequence |
| 12 |
{ |
| 13 |
typedef _Tp value_type; |
| 14 |
static constexpr size_t size() { return sizeof...(_Idx); } |
| 15 |
}; |
| 16 |
|
| 17 |
template<size_t... _Idx> |
| 18 |
using index_sequence = integer_sequence<size_t, _Idx...>; |
| 19 |
} |
| 20 |
|
| 21 |
void g(std::size_t a, std::size_t b, std::size_t c) |
| 22 |
{ |
| 23 |
printf("%zu, %zu, %zu\n", a, b, c); |
| 24 |
} |
| 25 |
|
| 26 |
template <std::size_t... Seq> |
| 27 |
void f(std::index_sequence<Seq...>) |
| 28 |
{ |
| 29 |
g(Seq...); |
| 30 |
} |
| 31 |
|
| 32 |
int main() |
| 33 |
{ |
| 34 |
f(std::index_sequence<0, 1, 2>()); |
| 35 |
} |