The following example demonstrates the problem I encountered in VC++ 2010:
class Foo
{
template<class T>
static T foo(T t) { return t; }
public:
void test()
{
auto lambda = []() { return foo(1); }; // call to Foo::foo<int>
lambda();
}
};
VC++ produces: error C3861: 'foo'
: identifier not found
If I qualify the call to foo: Foo::foo(1);
then this example compiles with a warning:
warning C4573: the usage of 'Foo::foo'
requires the compiler to capture 'this'
but the current default capture mode does not allow it
What does the standard say about this case? Should unqualified name be found? Does the qualified name require capturing this
?