[LLVMbugs] [Bug 13488] New: [Windows] error LNK2005: vftable already defined when linking with cl-compiled object files

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Jul 31 04:46:15 PDT 2012


http://llvm.org/bugs/show_bug.cgi?id=13488

             Bug #: 13488
           Summary: [Windows] error LNK2005: vftable already defined when
                    linking with cl-compiled object files
           Product: clang
           Version: unspecified
          Platform: PC
        OS/Version: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: timurrrr at google.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Repro (see notes below!):

$ cat with_clang.cpp
class A {
 public:
  virtual ~A();
};
A::~A() {}

$ cat with_cl.cpp
class A {
 public:
  virtual ~A();
};
int main() {
  A x;
}

$ clang -Xclang -cxx-abi -Xclang microsoft -fno-rtti -c with_clang.cpp
$ cl -nologo -c with_cl.cpp
$ link -nologo with_cl.obj with_clang.o
with_cl.cpp
with_clang.o : error LNK2005: "const A::`vftable'" (??_7A@@6B@) already defined
in with_cl.obj
with_cl.exe : fatal error LNK1169: one or more multiply defined symbols found

Notes:
my clang checkout is r160851 and has two patches applied:
1) revert r159091 due to bug 13231
2) local workaround for bug 12784 which doesn't emit Ctor_Complete,
Dtor_Deleting and Dtor_Complete when getCXXABI() == CXXABI_Microsoft

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list