On Tuesday, February 18, 2014 10:01:33 AM UTC-8, Nick wrote:
Yes.
That would be semantically really confusing and weird.
If you really need support for such a feature, a more logical syntax would not involve a bogus capture but would either explicitly indicate that the lambda requires 'this' be provided by the caller, e.g. [](Foo* this){ /* stuff */ }, or would allow any function with a pointer-to-class as the first parameter be convertible to member function pointer for that class type with the signature modified to remove that parameter, e.g. [](Foo* pFoo, int a, char b)->float{} converts to float(Foo::*)(int,char) and [](const Foo*){} converts to void(Foo::*)()const.
I'm unconvinced you at all need this instead of just using std::function, though. Conversion to regular function pointer makes sense for C compatibility which will never grow support for C++ types, but C++ code can just use the new stdlib types. Even most legacy C++ code could be converted more easily than requiring use of this feature given that it'll be years before any new feature potentially coming out of this discussion would ever be in a shipping compiler.