| 1 |
// PR c++/51852 |
| 2 |
// { dg-do compile { target c++11 } } |
| 3 |
// { dg-options "--param ggc-min-heapsize=0 --param ggc-min-expand=0" } |
| 4 |
|
| 5 |
template <typename, typename> |
| 6 |
class transformed {}; |
| 7 |
|
| 8 |
template <class R, class F> |
| 9 |
transformed<F, R> transform (R r, F f); |
| 10 |
|
| 11 |
template <typename, typename> |
| 12 |
class joined {}; |
| 13 |
|
| 14 |
template <typename T, typename U> |
| 15 |
joined<T, U> join (T t, U u); |
| 16 |
|
| 17 |
template <typename T, typename U, typename V, typename... Rest> |
| 18 |
auto join (T t, U u, V v, Rest... rest) -> decltype (join (join (t, u), v, rest...)); |
| 19 |
|
| 20 |
template <typename F, typename... Rs> |
| 21 |
auto polymorphic_transform (F f, Rs... rs) -> decltype (join (transform(rs, f)...)); |
| 22 |
|
| 23 |
int |
| 24 |
main () |
| 25 |
{ |
| 26 |
polymorphic_transform (0, 0, 0); |
| 27 |
} |