[llvm-bugs] [Bug 38524] New: Clang-cl link error virtual dtor of virtual base

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Aug 10 12:48:55 PDT 2018


https://bugs.llvm.org/show_bug.cgi?id=38524

            Bug ID: 38524
           Summary: Clang-cl link error virtual dtor of virtual base
           Product: clang
           Version: 7.0
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: jvapen at gmail.com
                CC: llvm-bugs at lists.llvm.org

Created attachment 20674
  --> https://bugs.llvm.org/attachment.cgi?id=20674&action=edit
Copy of reproduction

This bug looks a lot like a previous one I logged,
however, this contains the fixes of the bug it was merged with.
I've encountered the issue with both LLVM 6.0 as 7.0-RC1

All files below can be found in copy in the attachment

Error:
------
t.clang.obj : error LNK2019: unresolved external symbol "public: virtual
__cdecl C::~C(void)" (??1C@@UEAA at XZ) referenced in function "public: virtual
__cdecl G::~G(void)" (??1G@@UEAA at XZ)

Run.cmd
-------
cl.exe /nologo /c  /GR /EHsc   /std:c++17  /O2    t.cpp -w
cl.exe /nologo /c  /GR /EHsc   /std:c++17  /O2    u.cpp -w

move t.obj t.msvc.obj
move u.obj u.msvc.obj
link t.msvc.obj u.msvc.obj


e:\development\jva\other\software\llvm_7_0_0_r336178\bin\clang-cl.exe
-fms-compatibility-version=19.11  /nologo /c  /GR /EHsc   /std:c++17  /O2   
t.cpp -w
e:\development\jva\other\software\llvm_7_0_0_r336178\bin\clang-cl.exe
-fms-compatibility-version=19.11  /nologo /c  /GR /EHsc   /std:c++17  /O2   
u.cpp -w

move t.obj t.clang.obj
move u.obj u.clang.obj
link t.clang.obj u.clang.obj

t.h
---
class A {
public:
  virtual ~A() = default;
};
class B {
public:
  virtual ~B() = default;
};
class C : public B {
public:
  C() = default;
};
class D : public virtual C, public A {
public:
  virtual ~D() override = default;
};
class __declspec(dllexport) E {
public:
  explicit E();
  virtual ~E();
  E(const E &other) = delete;
  E &operator=(const E &rhs) = delete;
  E(E &&other);
  E &operator=(E &&rhs) = delete;
};
class __declspec(dllexport) F : public D, protected E {
public:
  explicit F();
  virtual ~F();
};
class __declspec(dllexport) G final {
public:
  explicit G();
  virtual ~G();
  F f;
};

t.cpp
-----
#include "t.h"
G::G() = default;
G::~G() = default;
int main(int, char **) {}

u.cpp
-----
#include "t.h"

E::E() = default;
E::~E() = default;
E::E(E &&) = default;

F::F() = default;
F::~F() = default;

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180810/c1b8866d/attachment.html>


More information about the llvm-bugs mailing list