diff options
author | John McCall <rjmccall@apple.com> | 2010-04-08 20:25:50 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2010-04-08 20:25:50 +0000 |
commit | ea7390c7b384ce607bfc8fc13c01f37cfc3776f0 (patch) | |
tree | 2bafbd8f85114c4c28181777a7cd25ba6bdad1b6 /lib/Sema/SemaTemplateInstantiateDecl.cpp | |
parent | 99d9838b256ded8e59f85c93647ba5ec060b7145 (diff) |
Set access properly on instantiated friend class template declarations.
Fixes PR6752.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100806 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaTemplateInstantiateDecl.cpp')
-rw-r--r-- | lib/Sema/SemaTemplateInstantiateDecl.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/Sema/SemaTemplateInstantiateDecl.cpp b/lib/Sema/SemaTemplateInstantiateDecl.cpp index e4690466d3..1ac854c770 100644 --- a/lib/Sema/SemaTemplateInstantiateDecl.cpp +++ b/lib/Sema/SemaTemplateInstantiateDecl.cpp @@ -753,7 +753,13 @@ Decl *TemplateDeclInstantiator::VisitClassTemplateDecl(ClassTemplateDecl *D) { D->getIdentifier(), InstParams, RecordInst, PrevClassTemplate); RecordInst->setDescribedClassTemplate(Inst); + if (isFriend) { + if (PrevClassTemplate) + Inst->setAccess(PrevClassTemplate->getAccess()); + else + Inst->setAccess(D->getAccess()); + Inst->setObjectOfFriendDecl(PrevClassTemplate != 0); // TODO: do we want to track the instantiation progeny of this // friend target decl? @@ -765,14 +771,13 @@ Decl *TemplateDeclInstantiator::VisitClassTemplateDecl(ClassTemplateDecl *D) { // Trigger creation of the type for the instantiation. SemaRef.Context.getInjectedClassNameType(RecordInst, Inst->getInjectedClassNameSpecialization(SemaRef.Context)); - + // Finish handling of friends. if (isFriend) { DC->makeDeclVisibleInContext(Inst, /*Recoverable*/ false); return Inst; } - Inst->setAccess(D->getAccess()); Owner->addDecl(Inst); // First, we sort the partial specializations by location, so |