Do not give implicitly-defined virtual members functions

available_externally linkage, since they may not have been given a
strong definition in another translation unit. Without this patch, the
following test case fails to link with a GCC-compiled libstdc++:

  #include <sstream>
  int main() { std::basic_stringbuf<char> bs; }

Fixes the last problem with the Boost.IO library.

llvm-svn: 103208
This commit is contained in:
Douglas Gregor
2010-05-06 23:13:35 +00:00
parent 21aa523c28
commit d8bb3aff76
2 changed files with 22 additions and 2 deletions

View File

@@ -322,8 +322,8 @@ GetLinkageForFunction(ASTContext &Context, const FunctionDecl *FD,
// only for inlining and analysis. This is the semantics of c99 inline.
if (const CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(FD)) {
const CXXRecordDecl *RD = MD->getParent();
if (MD->isVirtual() &&
CodeGenVTables::isKeyFunctionInAnotherTU(Context, RD))
if (MD->isVirtual() && !MD->isImplicit() &&
CodeGenVTables::isKeyFunctionInAnotherTU(Context, RD))
return CodeGenModule::GVA_C99Inline;
}