// PR c++/69066 // { dg-do compile { target c++14 } } template T&& declval(); template struct integral_constant { static constexpr T value = v; typedef T value_type; typedef integral_constant type; constexpr operator value_type() const { return value; } }; typedef integral_constant true_type; typedef integral_constant false_type; template using void_t = void; template class is_zero_callable : public false_type { }; template class is_zero_callable()())>> : public true_type { }; template struct curry_impl { static auto exec(TF f) { // Bind `x` to subsequent calls. return [=](auto x) { auto bound_f = [=](auto... xs) -> decltype(f(x, xs...)) { return f(x, xs...); }; // Recursive step. return curry_impl{}>::exec(bound_f); }; } }; template struct curry_impl { static auto exec(TF f) { return f(); } }; template auto curry(TF f) { return curry_impl{}>::exec(f); } int main() { auto sum = [](int x, int y) { return x + y; }; (void)curry(sum)(1)(1); }