This code fails to compile with gcc-c++-2.96-69: file test.cc: #include <vector> class LAS; template <class A> class EmROMReader { public: class DatabaseType { }; private: typedef std::vector<DatabaseType> DatabaseList; public: bool ContainsDB(void) { EmROMReader<LAS>::DatabaseList::const_iterator i; return false; } }; Compiling this code gives this error: test.cc: In method `bool EmROMReader<A>::ContainsDB ()': test.cc:8: `typedef class vector<EmROMReader<LAS>::DatabaseType, allocator<EmROMReader<LAS>::DatabaseType> > EmROMReader<LAS>::DatabaseList' is private test.cc:11: within this context I'm far from a c++ expert, but I assume one is able to use a private type within a public method of the same class (otherwice I see little value of private types). Making this a normal class works and compiling it with h8300-hms-g++ v.2.95.2 works (it doesn't give any warning).
Simplified testcase (with no need to include headers) is: class foo { public: typedef int a; }; class bar; template <class A> class baz { typedef foo b; public: void c(void) { baz<bar>::b::a i; } }; I believe g++ is correct though, ISO C++ access control clauses speak about same class, but you have a template and its instantiation, which are not the same thing. If you either use only b::a or baz<A>::b::a instead, then it will compile just fine. I'll ask C++ experts though...
Ok, Jason Merill (one of the 2 gcc C++ maintainers) confirumed that your code is not valid C++, a template and its instantation are not considered the same class when doing access control.