hintonda created this revision. Reset ScopeSpec when parsing class, struct, etc.. Fixes PR32953.
https://reviews.llvm.org/D34383 Files: lib/Parse/ParseDecl.cpp test/SemaTemplate/instantiate-complete.cpp Index: test/SemaTemplate/instantiate-complete.cpp =================================================================== --- test/SemaTemplate/instantiate-complete.cpp +++ test/SemaTemplate/instantiate-complete.cpp @@ -134,6 +134,14 @@ template class B<int>; // expected-note {{in instantiation}} } +namespace PR32953 { + struct bar {}; + template <typename A> struct Temp; // expected-note {{template is declared here}} + PR32953::bar struct Temp<int>::foo(); // expected-error {{implicit instantiation of undefined template 'PR32953::Temp<int>'}} \ + expected-error {{cannot combine with previous 'type-name' declaration specifier}} \ + expected-error {{expected unqualified-id}} +} + namespace PR8425 { template <typename T> class BaseT {}; 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<int>; // expected-note {{in instantiation}} } +namespace PR32953 { + struct bar {}; + template <typename A> struct Temp; // expected-note {{template is declared here}} + PR32953::bar struct Temp<int>::foo(); // expected-error {{implicit instantiation of undefined template 'PR32953::Temp<int>'}} \ + expected-error {{cannot combine with previous 'type-name' declaration specifier}} \ + expected-error {{expected unqualified-id}} +} + namespace PR8425 { template <typename T> class BaseT {}; 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.
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits