Original Post
I'm trying out the new C++0x features available in Visual Studio 2010 Beta 2, in particular the lambda expressions. I have however come across a curious error: in nested lambda functions, template parameters cease to exist. They do work in non-nested lambdas though. This code illustrates the problem which, to me, appears to be a bug in the compiler. I hope that I'm wrong. Odd?
template <typename T>
void f()
{
T x; // Works fine
[](){
T y; // As does this one
[](){
T z; // Not this one
};
};
}
int main()
{
f<int>();
}
// error C2065: 'T' : undeclared identifier
// error C2146: syntax error : missing ';' before identifier 'z'
// error C3493: 'z' cannot be implicitly captured because no default capture mode has been specified