diff --git a/clang/lib/AST/Type.cpp b/clang/lib/AST/Type.cpp index 1d064b135e36..8f22a1b197ac 100644 --- a/clang/lib/AST/Type.cpp +++ b/clang/lib/AST/Type.cpp @@ -3023,10 +3023,8 @@ static TagDecl *getInterestingTagDecl(TagDecl *decl) { if (I->isCompleteDefinition() || I->isBeingDefined()) return I; } - // If there's no definition (not even in progress), return the most recent - // declaration. This is important for template specializations, in order to - // pick the declaration with the most complete TemplateSpecializationKind. - return decl->getMostRecentDecl(); + // If there's no definition (not even in progress), return what we have. + return decl; } TagDecl *TagType::getDecl() const { diff --git a/clang/test/SemaTemplate/explicit-specialization-member.cpp b/clang/test/SemaTemplate/explicit-specialization-member.cpp index 4300ceb17ec0..f302836c7e4b 100644 --- a/clang/test/SemaTemplate/explicit-specialization-member.cpp +++ b/clang/test/SemaTemplate/explicit-specialization-member.cpp @@ -57,14 +57,3 @@ template struct Helper { template void Helper::func<2>() {} // expected-error {{cannot specialize a member}} \ // expected-error {{no function template matches}} } - -namespace b35070233 { - template struct Cls { - static void f() {} - }; - - void g(Cls); - - template<> struct Cls; // expected-note {{forward declaration}} - template<> void Cls::f(); // expected-error {{incomplete type}} -}