Why does the && argument type in the following example not behave as a so-called "universal reference" even though it seems to be in a "deduced context", and instead is interpreted as an r-value:
auto main() -> int {
using MyFn = void (*)(int &);
MyFn special = [](auto && thing) {}; // compile error, deduced as int && rather than int&
return 0;
}
Whereas the following, which I expect to be equivalent, does work?
template <typename T> void foo(T &&){};
auto main() -> int {
using MyFn = void (*)(int &);
MyFn specialC = foo;
return 0;
}
I suspect there's some esoteric detail with converting lambdas to function pointers that matters here, but so far I can't figure it out.