This has been resolved by a response from Ian Lance Taylor (thanks!). The gcc compiler doesn't like explicit instantiations inside class declarations. Moving the instantiations outside of the class fixed this problem. This also builds with the Visual Studio compiler as well. The fix is below: class ParentClass { public: class NestedForwardDeclaration; class NestedForwardDeclaration { ... }; }; template class SomeTemplate<ParentClass::NestedForwardDeclaration>; GodfatherofSoul wrote: > > I'm trying to migrate some Visual Studio code to gcc, but I'm getting > errors with some of our template usage: > > class ParentClass > { > public: > class NestedForwardDeclaration; > > template class SomeTemplateClass<NestedForwardDeclaration>; > > class NestedForwardDeclaration > { > ... > }; > > }; > > BTW, this is distilled down to the core cause of the problem, so you > really can't see the rationale for this convention. The complication > error I get is on the "template class.." line: > > error: expected `<' before 'class' > > Does anyone understand why this fails? Note that this same code compiles > and runs with the Microsoft compiler. > -- View this message in context: http://old.nabble.com/Template-Explicit-Instantiation-error-tp26157764p26157805.html Sent from the gcc - Help mailing list archive at Nabble.com.