aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaTemplateInstantiateDecl.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-03-01 19:00:07 +0000
committerDouglas Gregor <dgregor@apple.com>2010-03-01 19:00:07 +0000
commit96084f171f4824397dc48453146f0a9719cb9247 (patch)
treec92864eff4e445ea69c6a2e32e88f879857aa027 /lib/Sema/SemaTemplateInstantiateDecl.cpp
parent00225547b51b42f7400eed36475b6672418a1151 (diff)
When instantiating a function-scoped enum, make sure that it and its
enumeration constants get placed into the local instantiation hash table. Fixes PR6375. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97471 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaTemplateInstantiateDecl.cpp')
-rw-r--r--lib/Sema/SemaTemplateInstantiateDecl.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/Sema/SemaTemplateInstantiateDecl.cpp b/lib/Sema/SemaTemplateInstantiateDecl.cpp
index 0f7bae835f..292820b821 100644
--- a/lib/Sema/SemaTemplateInstantiateDecl.cpp
+++ b/lib/Sema/SemaTemplateInstantiateDecl.cpp
@@ -491,6 +491,9 @@ Decl *TemplateDeclInstantiator::VisitEnumDecl(EnumDecl *D) {
Owner->addDecl(Enum);
Enum->startDefinition();
+ if (D->getDeclContext()->isFunctionOrMethod())
+ SemaRef.CurrentInstantiationScope->InstantiatedLocal(D, Enum);
+
llvm::SmallVector<Sema::DeclPtrTy, 4> Enumerators;
EnumConstantDecl *LastEnumConst = 0;
@@ -530,6 +533,12 @@ Decl *TemplateDeclInstantiator::VisitEnumDecl(EnumDecl *D) {
Enum->addDecl(EnumConst);
Enumerators.push_back(Sema::DeclPtrTy::make(EnumConst));
LastEnumConst = EnumConst;
+
+ if (D->getDeclContext()->isFunctionOrMethod()) {
+ // If the enumeration is within a function or method, record the enum
+ // constant as a local.
+ SemaRef.CurrentInstantiationScope->InstantiatedLocal(*EC, EnumConst);
+ }
}
}