[cfe-commits] r93199 - in /cfe/trunk: lib/Sema/SemaLookup.cpp test/SemaTemplate/function-template-specialization.cpp

Douglas Gregor dgregor at apple.com
Mon Jan 11 14:40:46 PST 2010


Author: dgregor
Date: Mon Jan 11 16:40:45 2010
New Revision: 93199

URL: http://llvm.org/viewvc/llvm-project?rev=93199&view=rev
Log:
When performing name lookup into a scope, check that its entity is
non-NULL before looking at the entity itself.

Modified:
    cfe/trunk/lib/Sema/SemaLookup.cpp
    cfe/trunk/test/SemaTemplate/function-template-specialization.cpp

Modified: cfe/trunk/lib/Sema/SemaLookup.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaLookup.cpp?rev=93199&r1=93198&r2=93199&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaLookup.cpp (original)
+++ cfe/trunk/lib/Sema/SemaLookup.cpp Mon Jan 11 16:40:45 2010
@@ -648,7 +648,7 @@
 
   for (; S; S = S->getParent()) {
     DeclContext *Ctx = static_cast<DeclContext *>(S->getEntity());
-    if (Ctx->isTransparentContext())
+    if (!Ctx || Ctx->isTransparentContext())
       continue;
 
     assert(Ctx && Ctx->isFileContext() &&

Modified: cfe/trunk/test/SemaTemplate/function-template-specialization.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/function-template-specialization.cpp?rev=93199&r1=93198&r2=93199&view=diff

==============================================================================
--- cfe/trunk/test/SemaTemplate/function-template-specialization.cpp (original)
+++ cfe/trunk/test/SemaTemplate/function-template-specialization.cpp Mon Jan 11 16:40:45 2010
@@ -33,3 +33,11 @@
 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) {}
+





More information about the cfe-commits mailing list