[LLVMbugs] [Bug 15063] New: [-cxx-abi] Incorrect linkage for the vftable?

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Jan 25 05:02:59 PST 2013


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

             Bug #: 15063
           Summary: [-cxx-abi] Incorrect linkage for the vftable?
           Product: clang
           Version: trunk
          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


While working on bug 15058 and the destructor part of bug 12784,
I've found we're doing something wrong with the vftable linkage:
-----------------------------
$ cat with_cl.cpp
struct Base {
  virtual ~Base();
};

struct Child: Base {
  void foo() {}
};

int main() {
  Child obj;
}
-----------------------------
$ cat with_clang.cpp
struct Base {
  virtual ~Base();
};

Base::~Base() {}
-----------------------------

$ cl -nologo -c with_cl.cpp with_clang.cpp && \
  link -nologo with_cl.obj with_clang.obj && \
  ./with_cl.exe && echo OK
-> OK

$ cl -nologo -c with_cl.cpp && \
  clang++ -Xclang -cxx-abi -Xclang microsoft -fno-rtti -c with_clang.cpp && \
  link -nologo with_cl.obj with_clang.o && ./with_cl.exe
->
with_clang.o : error LNK2005: "const Base::`vftable'" (??_7Base@@6B@) already
defined in with_cl.obj


It looks like Clang assumes that the vftable should only be emitted when
there's a destructor definition in this object file, whilst VS generates it
more often.

-- 
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