aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2010-02-15 22:12:26 +0000
committerChandler Carruth <chandlerc@gmail.com>2010-02-15 22:12:26 +0000
commit17e0f407d56748da21050db13ff3a093b1ffdcb7 (patch)
tree795b6cc95f2e646bec4fb06df9d10083e056938d /lib
parent44703f59ed2ae7854a08cf67cb2474c31e0698ec (diff)
Fix instantiation of template functions with local classes that contain virtual
methods. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96283 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Sema/SemaTemplateInstantiate.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/Sema/SemaTemplateInstantiate.cpp b/lib/Sema/SemaTemplateInstantiate.cpp
index 2d354575f0..51e17fe472 100644
--- a/lib/Sema/SemaTemplateInstantiate.cpp
+++ b/lib/Sema/SemaTemplateInstantiate.cpp
@@ -1130,9 +1130,18 @@ Sema::InstantiateClass(SourceLocation PointOfInstantiation,
// If this is a polymorphic C++ class without a key function, we'll
// have to mark all of the virtual members to allow emission of a vtable
// in this translation unit.
- if (Instantiation->isDynamicClass() && !Context.getKeyFunction(Instantiation))
+ if (Instantiation->isDynamicClass() &&
+ !Context.getKeyFunction(Instantiation)) {
+ // Local classes need to have their methods instantiated immediately in
+ // order to have the correct instantiation scope.
+ if (Instantiation->isLocalClass()) {
+ MarkVirtualMembersReferenced(PointOfInstantiation,
+ Instantiation);
+ } else {
ClassesWithUnmarkedVirtualMembers.push_back(std::make_pair(Instantiation,
PointOfInstantiation));
+ }
+ }
if (!Invalid)
Consumer.HandleTagDeclDefinition(Instantiation);