Why compiler cant't compile this code?template <class T>void f(){ ([&]() { typename T::type x; })();}struct X{ typedef int type;};int main(){ f<X>();}When I try to compile it, I get the next diagnostic:Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.40219.01 for 80x86Copyright (C) Microsoft Corporation. All rights reserved.test.cpptest.cpp(4) : error C2899: typename cannot be used outside a template declarationtest.cpp(4) : error C2653: 'T' : is not a class or namespace nametest.cpp(4) : error C2065: 'type' : undeclared identifiertest.cpp(4) : error C2146: syntax error : missing ';' before identifier 'x'test.cpp(4) : error C2065: 'x' : undeclared identifierThis code is correct as I know and Intel C++ 12.1 proves it.But VC++ 10.0 SP1 compiles this code:template <class T> void f(){ ([&]() { typedef T TT; TT::type x; })();}I think this is not correct because of typename keyword lack before TT::type
Visual Studio/Team Foundation Server/.NET Framework Tooling version
Steps to reproduce
Product Language
Operating System
Operating System Language
Actual results
Expected results
Please wait...