summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaTemplate.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-11-03 16:37:14 +0000
committerDouglas Gregor <dgregor@apple.com>2011-11-03 16:37:14 +0000
commitdd847baaddd02a2cebb8b2b994636fbbe1ef0451 (patch)
tree0cdbf5665f64def7b1c73e13218a3f543ce75291 /clang/lib/Sema/SemaTemplate.cpp
parentf82d8064d43954c64ba59478d8e5f8d9418e7dd6 (diff)
downloadbcm5719-llvm-dd847baaddd02a2cebb8b2b994636fbbe1ef0451.tar.gz
bcm5719-llvm-dd847baaddd02a2cebb8b2b994636fbbe1ef0451.zip
When we're checking a friend function template in an out-of-line class
definition, we may not have a scope corresponding to the namespace where that friend function template actually lives. Work around this issue by faking up a scope with the appropriate DeclContext. This is a bit of a hack, but it fixes <rdar://problem/10204947>. llvm-svn: 143614
Diffstat (limited to 'clang/lib/Sema/SemaTemplate.cpp')
-rw-r--r--clang/lib/Sema/SemaTemplate.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp
index 9c14976f0ae..2d7e85094aa 100644
--- a/clang/lib/Sema/SemaTemplate.cpp
+++ b/clang/lib/Sema/SemaTemplate.cpp
@@ -4455,6 +4455,9 @@ Sema::TemplateParameterListsAreEqual(TemplateParameterList *New,
/// false. Otherwise, issues a diagnostic and returns true.
bool
Sema::CheckTemplateDeclScope(Scope *S, TemplateParameterList *TemplateParams) {
+ if (!S)
+ return false;
+
// Find the nearest enclosing declaration scope.
while ((S->getFlags() & Scope::DeclScope) == 0 ||
(S->getFlags() & Scope::TemplateParamScope) != 0)
OpenPOWER on IntegriCloud