aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaTemplateInstantiateDecl.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2012-03-23 03:33:32 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2012-03-23 03:33:32 +0000
commit1af83c444e5a2f6f50a6e1c15e6ebc618ae18a5f (patch)
tree8a325a6f98d042574b75774b359263f77a7d32e8 /lib/Sema/SemaTemplateInstantiateDecl.cpp
parentccc6f36e53274fccae024f30ac5adb6be6f815d3 (diff)
Support for definitions of member enumerations of class templates outside the
class template's definition, and for explicit specializations of such enum members. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153304 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaTemplateInstantiateDecl.cpp')
-rw-r--r--lib/Sema/SemaTemplateInstantiateDecl.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/Sema/SemaTemplateInstantiateDecl.cpp b/lib/Sema/SemaTemplateInstantiateDecl.cpp
index d0ba4db0b5..ebc43d443d 100644
--- a/lib/Sema/SemaTemplateInstantiateDecl.cpp
+++ b/lib/Sema/SemaTemplateInstantiateDecl.cpp
@@ -600,7 +600,7 @@ Decl *TemplateDeclInstantiator::VisitEnumDecl(EnumDecl *D) {
// not the definitions of scoped member enumerations.
// FIXME: There appears to be no wording for what happens for an enum defined
// within a block scope, but we treat that like a member of a class template.
- if (!Enum->isScoped())
+ if (!Enum->isScoped() && D->getDefinition())
InstantiateEnumDefinition(Enum, D);
return Enum;
@@ -610,6 +610,9 @@ void TemplateDeclInstantiator::InstantiateEnumDefinition(
EnumDecl *Enum, EnumDecl *Pattern) {
Enum->startDefinition();
+ // Update the location to refer to the definition.
+ Enum->setLocation(Pattern->getLocation());
+
SmallVector<Decl*, 4> Enumerators;
EnumConstantDecl *LastEnumConst = 0;