Index: lib/Parse/ParseDecl.cpp =================================================================== --- lib/Parse/ParseDecl.cpp +++ lib/Parse/ParseDecl.cpp @@ -3581,6 +3581,8 @@ tok::TokenKind Kind = Tok.getKind(); ConsumeToken(); + DS.getTypeSpecScope() = CXXScopeSpec(); + // These are attributes following class specifiers. // To produce better diagnostic, we parse them when // parsing class specifier. Index: test/SemaTemplate/instantiate-complete.cpp =================================================================== --- test/SemaTemplate/instantiate-complete.cpp +++ test/SemaTemplate/instantiate-complete.cpp @@ -134,6 +134,14 @@ template class B; // expected-note {{in instantiation}} } +namespace PR32953 { + struct bar {}; + template struct Temp; // expected-note {{template is declared here}} + PR32953::bar struct Temp::foo(); // expected-error {{implicit instantiation of undefined template 'PR32953::Temp'}} \ + expected-error {{cannot combine with previous 'type-name' declaration specifier}} \ + expected-error {{expected unqualified-id}} +} + namespace PR8425 { template class BaseT {};