From: Douglas Gregor Date: Mon, 11 Jan 2010 22:40:45 +0000 (+0000) Subject: When performing name lookup into a scope, check that its entity is X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=277d280c20d4414d61e307789949bef8ee3063fd;p=clang When performing name lookup into a scope, check that its entity is non-NULL before looking at the entity itself. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93199 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/SemaLookup.cpp b/lib/Sema/SemaLookup.cpp index a8c2366c59..bff7881eb6 100644 --- a/lib/Sema/SemaLookup.cpp +++ b/lib/Sema/SemaLookup.cpp @@ -648,7 +648,7 @@ bool Sema::CppLookupName(LookupResult &R, Scope *S) { for (; S; S = S->getParent()) { DeclContext *Ctx = static_cast(S->getEntity()); - if (Ctx->isTransparentContext()) + if (!Ctx || Ctx->isTransparentContext()) continue; assert(Ctx && Ctx->isFileContext() && diff --git a/test/SemaTemplate/function-template-specialization.cpp b/test/SemaTemplate/function-template-specialization.cpp index 91989b1cca..9afc99fe7d 100644 --- a/test/SemaTemplate/function-template-specialization.cpp +++ b/test/SemaTemplate/function-template-specialization.cpp @@ -33,3 +33,11 @@ template<> void f2(double (&array)[42]); template<> void f2<42>(double (&array)[42]); void f2<25>(double (&array)[25]); // expected-error{{specialization}} + +// PR5833 +namespace PR5833 { + template bool f0(T &t1); + template <> bool f0(float &t1); +} +template <> bool PR5833::f0(float &t1) {} +