vendredi 18 février 2022

return type deduction of lambda function not working

Why does the following code not compile? Why do I have to tell the compiler that the passed function pointer returns a double? (It works if one explicitly calls call<double>()!)

template<typename T>
void call(T (*const _pF)(void))
{
}
int main(int, char**)
{       call(
                [](void) -> double
                {       return 1.0;
                }
        );
}

Aucun commentaire:

Enregistrer un commentaire