http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46719
--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> 2010-11-30
20:04:00 UTC ---
(In reply to comment #3)
>
> Therefore compiler is unable to deduce template parameters that are Return,
> FirstType and ArgTypes.
Right, the lambda can be converted to double(*)(int) but that doesn't help.
There is no valid conversion sequence that allows the compiler to deduce the
template arguments.
Here's a version without a lambda:
template <typename Return, typename... ArgTypes>
struct function
{
template<typename Functor> function(Functor) { }
};
template <typename Return, typename FirstType, typename... ArgTypes>
int
curry(function<Return(FirstType,ArgTypes...)> func, FirstType)
{
return 0;
}
double f(int x) { return static_cast<double>(x); }
int main()
{
return curry( f, 10 );
}