diff options
author | Chandler Carruth <chandlerc@gmail.com> | 2010-02-15 22:12:26 +0000 |
---|---|---|
committer | Chandler Carruth <chandlerc@gmail.com> | 2010-02-15 22:12:26 +0000 |
commit | 3e0c140c501c0ee194bf02d92451d6e7d638b4fa (patch) | |
tree | 42ee7ba1b95c32802e51091570b14852852f8497 /clang/lib/Sema/SemaTemplateInstantiate.cpp | |
parent | 1d9a8159df8beb0780a52fb557fea54dfc1ad1e9 (diff) | |
download | bcm5719-llvm-3e0c140c501c0ee194bf02d92451d6e7d638b4fa.tar.gz bcm5719-llvm-3e0c140c501c0ee194bf02d92451d6e7d638b4fa.zip |
Fix instantiation of template functions with local classes that contain virtual
methods.
llvm-svn: 96283
Diffstat (limited to 'clang/lib/Sema/SemaTemplateInstantiate.cpp')
-rw-r--r-- | clang/lib/Sema/SemaTemplateInstantiate.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaTemplateInstantiate.cpp b/clang/lib/Sema/SemaTemplateInstantiate.cpp index 2d354575f0e..51e17fe472e 100644 --- a/clang/lib/Sema/SemaTemplateInstantiate.cpp +++ b/clang/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); |