A few weeks ago I wrote a trait class for 2d entities like this:
template<typename T>
struct traits_2d
{
typedef T coordinates_type;
typedef vector_2d<T> position_type;
typedef vector_2d<T> direction_type;
typedef vector_2d<T> size_type;
};
The trait class was used as follows:
template<typename T>
struct aabb_2d : public traits_2d<T>
{
position_type origin;
size_type size;
};
The Standard says that template dependent names must be fully qualified, so this should not compile. Of course GCC compilation fails and says something like:
Expected nested-name specifier. Could be '
typename traits_2d<T>::position_type
'.
But, on the other hand, I was using this pattern for two weeks in MSVC11 (Visual Studio 2012) and it works and compiles fine.
Why seems like MSVC11 does not follow this language rule?
NOTE: This question is not a duplicate of Propagating 'typedef' from based to derived class for 'template' or its duplicates, it asks about why something that should be an error works in MSVC.