The following code compiles correctly in g++ and clang:
template<typename T>
struct foo
{
class iterator;
using bar = foo::iterator;
};
int main() {}
however MSVC 2013 gives the following errors:
foo.cpp(9): error C2061: syntax error : identifier 'iterator'
foo.cpp(10) : see reference to class template instantiation 'foo<T>' being compiled
foo.cpp(9): error C2238: unexpected token(s) preceding ';'
If I change that line to:
using bar = typename foo::iterator;
then all three compilers compile it successfully. Is the original version correct? (i.e. is this a MSVC bug, or a gcc/clang extension)