Why does the compiler deny conversion of variadic lamda to function pointer? The conversion works perfectly fine without the variadic args.
auto lambda = [] (void *, const char *) {};
auto variadicLambda = [] (void *, const char *, auto ...) {};
auto ptrLambda = +[] (void *, const char *) {};
auto ptrVariadicLambda = +[] (void *, const char *, auto ...) {};
Tried with gcc 12.2 and clang 15.0.0.
<source>:7:30: error: invalid argument type '(lambda at <source>:7:31)' to unary expression
auto ptrVariadicLambda = +[] (void *, const char *, auto ...) {};
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
autocreates a generic lambda, which is a templated functor and templates are not objects.(void *, const char *, int)and(void *, const char *, float)are different function and cannot squeeze into same pointer. (and what's the pointer type is another problem)