diff options
author | Douglas Gregor <dgregor@apple.com> | 2012-03-17 23:06:31 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2012-03-17 23:06:31 +0000 |
commit | 42aceadbc3806868cee8ac576347d258ac99e1f6 (patch) | |
tree | 485d8f0e3546c1d43dfe552ea24878157fe0bb00 /lib/Sema/SemaTemplate.cpp | |
parent | f3aae58296fd5f930f7c4c0709886924e6822ae7 (diff) |
Diagnose tag and class template declarations with qualified
declarator-ids that occur at class scope. Fixes PR8019.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153002 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaTemplate.cpp')
-rw-r--r-- | lib/Sema/SemaTemplate.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/Sema/SemaTemplate.cpp b/lib/Sema/SemaTemplate.cpp index 37c7cefb0d..afa6c0e15b 100644 --- a/lib/Sema/SemaTemplate.cpp +++ b/lib/Sema/SemaTemplate.cpp @@ -886,7 +886,9 @@ Sema::CheckClassTemplate(Scope *S, unsigned TagSpec, TagUseKind TUK, ContextRAII SavedContext(*this, SemanticContext); if (RebuildTemplateParamsInCurrentInstantiation(TemplateParams)) Invalid = true; - } + } else if (CurContext->isRecord() && TUK != TUK_Friend && + TUK != TUK_Reference) + diagnoseQualifiedDeclInClass(SS, SemanticContext, Name, NameLoc); LookupQualifiedName(Previous, SemanticContext); } else { @@ -1065,7 +1067,7 @@ Sema::CheckClassTemplate(Scope *S, unsigned TagSpec, TagUseKind TUK, PrevClassTemplate->setMemberSpecialization(); // Set the access specifier. - if (!Invalid && TUK != TUK_Friend) + if (!Invalid && TUK != TUK_Friend && NewTemplate->getDeclContext()->isRecord()) SetMemberAccessSpecifier(NewTemplate, PrevClassTemplate, AS); // Set the lexical context of these templates |