I\'ve run into a strange problem. The following simplified code reproduces the problem in MSVC 2010:
template
struct dummy
{
static T f
Function-local enums cannot be detected by lambdas either.
int main()
{
enum E {A, B, C};
auto x = [](){ int a = A; };
//auto y = [](){ E a = A; }; // this will crash the compiler
}
error C3493: 'A' cannot be implicitly captured because no default capture mode has been specified
Following is a workround, problematic-maybe though.
int main()
{
enum E {A, B, C};
auto x = [=](){ int a = A; };
// typedef E F;
// auto y = [=](){ F a = A; }; // this compiles ok
}