]> granicus.if.org Git - clang/commitdiff
When performing name lookup into a scope, check that its entity is
authorDouglas Gregor <dgregor@apple.com>
Mon, 11 Jan 2010 22:40:45 +0000 (22:40 +0000)
committerDouglas Gregor <dgregor@apple.com>
Mon, 11 Jan 2010 22:40:45 +0000 (22:40 +0000)
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

lib/Sema/SemaLookup.cpp
test/SemaTemplate/function-template-specialization.cpp

index a8c2366c59bbf01ea342a23c26f7a76e43172444..bff7881eb6b2f381a4a69cfcd27c81c0b0feb794 100644 (file)
@@ -648,7 +648,7 @@ bool Sema::CppLookupName(LookupResult &R, Scope *S) {
 
   for (; S; S = S->getParent()) {
     DeclContext *Ctx = static_cast<DeclContext *>(S->getEntity());
-    if (Ctx->isTransparentContext())
+    if (!Ctx || Ctx->isTransparentContext())
       continue;
 
     assert(Ctx && Ctx->isFileContext() &&
index 91989b1ccae070d5185c79b4cbeb3ea0b3189235..9afc99fe7d5e8a42ecbfcf179f7348607f2294f8 100644 (file)
@@ -33,3 +33,11 @@ template<> void f2<double>(double (&array)[42]);
 template<> void f2<42>(double (&array)[42]);
 
 void f2<25>(double (&array)[25]); // expected-error{{specialization}} 
+
+// PR5833
+namespace PR5833 {
+  template <typename T> bool f0(T &t1);
+  template <> bool f0<float>(float &t1);
+}
+template <> bool PR5833::f0<float>(float &t1) {}
+