aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaAccess.cpp
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2010-03-25 02:56:08 +0000
committerJohn McCall <rjmccall@apple.com>2010-03-25 02:56:08 +0000
commita56623b01ed9f28f10416432d147c7a1729d5f1d (patch)
tree31d4a5f62a0694321a9837ed0af6cdcdd522fb06 /lib/Sema/SemaAccess.cpp
parentf7b714df46cdbdf9e2ebf26eb2fd7881790d83e6 (diff)
Properly instantiate and link in friend-class-template declarations.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99477 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaAccess.cpp')
-rw-r--r--lib/Sema/SemaAccess.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/Sema/SemaAccess.cpp b/lib/Sema/SemaAccess.cpp
index 7e2520c9ee..62b13d4e95 100644
--- a/lib/Sema/SemaAccess.cpp
+++ b/lib/Sema/SemaAccess.cpp
@@ -240,13 +240,13 @@ static Sema::AccessResult MatchesFriend(Sema &S,
ClassTemplateDecl *Friend) {
Sema::AccessResult OnFailure = Sema::AR_inaccessible;
+ // Check whether the friend is the template of a class in the
+ // context chain.
for (llvm::SmallVectorImpl<CXXRecordDecl*>::const_iterator
I = EC.Records.begin(), E = EC.Records.end(); I != E; ++I) {
CXXRecordDecl *Record = *I;
- // Check whether the friend is the template of a class in the
- // context chain. To do that, we need to figure out whether the
- // current class has a template:
+ // Figure out whether the current class has a template:
ClassTemplateDecl *CTD;
// A specialization of the template...
@@ -264,6 +264,10 @@ static Sema::AccessResult MatchesFriend(Sema &S,
if (Friend == CTD->getCanonicalDecl())
return Sema::AR_accessible;
+ // If the context isn't dependent, it can't be a dependent match.
+ if (!EC.isDependent())
+ continue;
+
// If the template names don't match, it can't be a dependent
// match. This isn't true in C++0x because of template aliases.
if (!S.LangOpts.CPlusPlus0x && CTD->getDeclName() != Friend->getDeclName())