summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-01-11 22:40:45 +0000
committerDouglas Gregor <dgregor@apple.com>2010-01-11 22:40:45 +0000
commit88f3eb898a0ace0ff161c52508bd33ffdfc75bf5 (patch)
tree4376c8ca70db8216a4f638db80f670cade46b2f8
parent394bf0d0ba9f5b89ce5fdfa1f024e92a2deada22 (diff)
downloadbcm5719-llvm-88f3eb898a0ace0ff161c52508bd33ffdfc75bf5.tar.gz
bcm5719-llvm-88f3eb898a0ace0ff161c52508bd33ffdfc75bf5.zip
When performing name lookup into a scope, check that its entity is
non-NULL before looking at the entity itself. llvm-svn: 93199
-rw-r--r--clang/lib/Sema/SemaLookup.cpp2
-rw-r--r--clang/test/SemaTemplate/function-template-specialization.cpp8
2 files changed, 9 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaLookup.cpp b/clang/lib/Sema/SemaLookup.cpp
index a8c2366c59b..bff7881eb6b 100644
--- a/clang/lib/Sema/SemaLookup.cpp
+++ b/clang/lib/Sema/SemaLookup.cpp
@@ -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() &&
diff --git a/clang/test/SemaTemplate/function-template-specialization.cpp b/clang/test/SemaTemplate/function-template-specialization.cpp
index 91989b1ccae..9afc99fe7d5 100644
--- a/clang/test/SemaTemplate/function-template-specialization.cpp
+++ b/clang/test/SemaTemplate/function-template-specialization.cpp
@@ -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) {}
+
OpenPOWER on IntegriCloud