Is the following code valid according to (any) C++ ISO standards?
#include <functional>
auto a() {
struct Foo {
};
return []() {return Foo{}; };
}
int main()
{
auto l = a()();
decltype(l) ll;
//Foo f; //error: unknown type name 'Foo'
return 0;
}
The compilers (Visual studio 2015, latest Clang and latest GCC) accept this but it seems weird that decltype should give me access to Foo.