aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaTemplateInstantiate.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-03-24 01:33:17 +0000
committerDouglas Gregor <dgregor@apple.com>2010-03-24 01:33:17 +0000
commit05030bb6790b259a169b25665656db2aee30ccda (patch)
tree23449e79eedb59a22733de726b049934ca57b802 /lib/Sema/SemaTemplateInstantiate.cpp
parentf532f3b4a642ad5d9704c4a1d17b61cc52ab2f65 (diff)
Each non-local class instantiation is its own local instantiation
scope. Fixes PR6619. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99377 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaTemplateInstantiate.cpp')
-rw-r--r--lib/Sema/SemaTemplateInstantiate.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/Sema/SemaTemplateInstantiate.cpp b/lib/Sema/SemaTemplateInstantiate.cpp
index 0d6acd0e81..ac1bf7219c 100644
--- a/lib/Sema/SemaTemplateInstantiate.cpp
+++ b/lib/Sema/SemaTemplateInstantiate.cpp
@@ -1159,6 +1159,12 @@ Sema::InstantiateClass(SourceLocation PointOfInstantiation,
DeclContext *PreviousContext = CurContext;
CurContext = Instantiation;
+ // If this is an instantiation of a local class, merge this local
+ // instantiation scope with the enclosing scope. Otherwise, every
+ // instantiation of a class has its own local instantiation scope.
+ bool MergeWithParentScope = !Instantiation->isDefinedOutsideFunctionOrMethod();
+ Sema::LocalInstantiationScope Scope(*this, MergeWithParentScope);
+
// Start the definition of this instantiation.
Instantiation->startDefinition();