diff options
author | John McCall <rjmccall@apple.com> | 2009-12-18 11:25:59 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2009-12-18 11:25:59 +0000 |
commit | d43784feae5bc1b6925ca1dc49d303ef44bac916 (patch) | |
tree | c379c82ad0542b1c99dc20a2dc2345108bd77755 /clang/lib/Sema/SemaTemplate.cpp | |
parent | c3f09ad253b6d72f411adc70cd58a40710886a19 (diff) | |
download | bcm5719-llvm-d43784feae5bc1b6925ca1dc49d303ef44bac916.tar.gz bcm5719-llvm-d43784feae5bc1b6925ca1dc49d303ef44bac916.zip |
Set up the semantic context correctly when declaring a friend class template.
llvm-svn: 91678
Diffstat (limited to 'clang/lib/Sema/SemaTemplate.cpp')
-rw-r--r-- | clang/lib/Sema/SemaTemplate.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp index c1d828fe45e..9b046e3696a 100644 --- a/clang/lib/Sema/SemaTemplate.cpp +++ b/clang/lib/Sema/SemaTemplate.cpp @@ -711,7 +711,7 @@ Sema::CheckClassTemplate(Scope *S, unsigned TagSpec, TagUseKind TUK, } } - if (PrevDecl && TUK == TUK_Friend) { + if (TUK == TUK_Friend) { // C++ [namespace.memdef]p3: // [...] When looking for a prior declaration of a class or a function // declared as a friend, and when the name of the friend class or @@ -720,9 +720,10 @@ Sema::CheckClassTemplate(Scope *S, unsigned TagSpec, TagUseKind TUK, DeclContext *OutermostContext = CurContext; while (!OutermostContext->isFileContext()) OutermostContext = OutermostContext->getLookupParent(); - - if (OutermostContext->Equals(PrevDecl->getDeclContext()) || - OutermostContext->Encloses(PrevDecl->getDeclContext())) { + + if (PrevDecl && + (OutermostContext->Equals(PrevDecl->getDeclContext()) || + OutermostContext->Encloses(PrevDecl->getDeclContext()))) { SemanticContext = PrevDecl->getDeclContext(); } else { // Declarations in outer scopes don't matter. However, the outermost |