The following gives the error 'one': identifier not found in VS2010 and VS2012
int main()
{
struct one {};
[](){ return one(); }();
}
And with a slight tweak…
int main()
{
struct one {};
[](){ one uno; return uno; }();
}
VS2010/VS2012 both have a compiler crash from this code.
So, the question is (ignoring the compiler crash), are lambas supposed to be able to have visibility of local classes?
Yes, VS is incorrect. From 5.1.2p7: