I've seen other posts asking a similar question, but the solution continues to evade me.
I have a line of code that compiles and runs as designed with MSVC but not under g++ 3.4.2 (mingw-special): HashTable<Factory<AbstractProductUnitTest>::FactoryEntry> Factory<AbstractProductUnitTest>::sFactoryTable ; The following lines do compile (but see caveat below): template <class EntryT> class HashTable<Factory<AbstractProductUnitTest>::FactoryEntry> Factory<AbstractProductUnitTest>::sFactoryTable ; ...or... template <> class HashTable<Factory<AbstractProductUnitTest>::FactoryEntry> Factory<AbstractProductUnitTest>::sFactoryTable ; The resulting code, however, seems not to have called the constructor on sFactoryTable by the time it gets used, which is well after "main" starts - i.e. this is not a problem with order of execution of static constructors. Here is some context for the code above: template <class EntryT> class HashTable { ... protected: LinkedList<EntryT> * mLists ; ... } ; template <class AbstractProductT> class Factory : public HashEntry { ... protected: struct FactoryEntry : public HashEntry { // struct to associate a factory with a hash table key. Factory<AbstractProductT> * mFactory ; } ; static HashTable<FactoryEntry> sFactoryTable ; // singleton list of concrete factories associated with this abstract factory } ; I searched http://gcc.gnu.org/ and found several simpler variations where people complained about initialization of static templated class members, the solution to which was to prefix the class name with "template <>", but I found no mention of a situation like that above, which involves nested templated classes. I apologize if this reflects my ignorance rather than a bug in the GNU C compiler, and would appreciate having somebody explain how to make this work. Thanks. Michael J. Gourlay