diff options
author | Douglas Gregor <dgregor@apple.com> | 2011-09-09 19:05:14 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2011-09-09 19:05:14 +0000 |
commit | e761230ae3751b525cadd8066c74ec278ee4ef57 (patch) | |
tree | 459e36d24abbe4c0680f2795203885991b4a6eb6 /lib/Sema/SemaTemplate.cpp | |
parent | 9134294114c15b938f2ff954995d9f00f63dd9d8 (diff) |
__module_private__ is inherited by redeclarations of an entity, and
must also be present of the first declaration of that entity.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139384 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaTemplate.cpp')
-rw-r--r-- | lib/Sema/SemaTemplate.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/lib/Sema/SemaTemplate.cpp b/lib/Sema/SemaTemplate.cpp index eb199aced4..4b3f6c45d5 100644 --- a/lib/Sema/SemaTemplate.cpp +++ b/lib/Sema/SemaTemplate.cpp @@ -811,7 +811,7 @@ Sema::CheckClassTemplate(Scope *S, unsigned TagSpec, TagUseKind TUK, IdentifierInfo *Name, SourceLocation NameLoc, AttributeList *Attr, TemplateParameterList *TemplateParams, - AccessSpecifier AS, bool IsModulePrivate, + AccessSpecifier AS, SourceLocation ModulePrivateLoc, unsigned NumOuterTemplateParamLists, TemplateParameterList** OuterTemplateParamLists) { assert(TemplateParams && TemplateParams->size() > 0 && @@ -1002,8 +1002,13 @@ Sema::CheckClassTemplate(Scope *S, unsigned TagSpec, TagUseKind TUK, if (PrevClassTemplate && PrevClassTemplate->isModulePrivate()) { NewTemplate->setModulePrivate(); - } else if (IsModulePrivate) - NewTemplate->setModulePrivate(); + } else if (ModulePrivateLoc.isValid()) { + if (PrevClassTemplate && !PrevClassTemplate->isModulePrivate()) + diagnoseModulePrivateRedeclaration(NewTemplate, PrevClassTemplate, + ModulePrivateLoc); + else + NewTemplate->setModulePrivate(); + } // Build the type for the class template declaration now. QualType T = NewTemplate->getInjectedClassNameSpecialization(); @@ -4943,7 +4948,7 @@ Sema::ActOnClassTemplateSpecialization(Scope *S, unsigned TagSpec, TemplateNameLoc, Attr, TemplateParams, - AS_none, /*IsModulePrivate=*/false, + AS_none, /*ModulePrivateLoc=*/SourceLocation(), TemplateParameterLists.size() - 1, (TemplateParameterList**) TemplateParameterLists.release()); } @@ -5978,7 +5983,7 @@ Sema::ActOnExplicitInstantiation(Scope *S, bool IsDependent = false; Decl *TagD = ActOnTag(S, TagSpec, Sema::TUK_Reference, KWLoc, SS, Name, NameLoc, Attr, AS_none, - /*IsModulePrivate=*/false, + /*ModulePrivateLoc=*/SourceLocation(), MultiTemplateParamsArg(*this, 0, 0), Owned, IsDependent, false, false, TypeResult()); |