diff options
author | John McCall <rjmccall@apple.com> | 2010-03-25 06:39:04 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2010-03-25 06:39:04 +0000 |
commit | 93ba8579c341d5329175f1413cdc3b35a36592d2 (patch) | |
tree | adef254c610bbd97ccc00fb9174b0e31f45142fd /lib/Sema/SemaAccess.cpp | |
parent | ef0df6a1c2a626f69dc11519cf88a50ca321065d (diff) |
Properly instantiate friend class template declarations and link them into
the redeclaration chain. Recommitted from r99477 with a fix: we need to
merge in default template arguments from previous declarations.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99496 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaAccess.cpp')
-rw-r--r-- | lib/Sema/SemaAccess.cpp | 10 |
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()) |