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

            Bug ID: 38521
           Summary: [Microsoft ABI] Inline destructors are not emitted
                    when a virtual subclass's complete destructor is used
           Product: clang
           Version: 6.0
          Hardware: PC
                OS: Windows XP
            Status: NEW
          Severity: normal
          Priority: P
         Component: LLVM Codegen
          Assignee: unassignedclangb...@nondot.org
          Reporter: n...@tresorit.com
                CC: llvm-bugs@lists.llvm.org

In the following example the X<void>::~X<void> destructor is not emitted in
either TU.

If I understand correctly, it should be emitted when compiling "a.cpp" where
Y's complete destructor is used because of:
// A TU defining a non-inline destructor is only guaranteed to emit a base
// destructor, and all of the other variants are emitted on an as-needed basis
// in COMDATs.  Because a non-base destructor can be emitted in a TU that
// lacks a definition for the destructor, non-base destructors must always
// delegate to or alias the base destructor.

Compile with:
clang++ -target i386-pc-windows-msvc -fuse-ld=lld-link -nostdlib
-Wl,/ENTRY:start a.cpp b.cpp
/usr/bin/lld-link: error: /tmp/a-785134.o: undefined symbol: ??1?$X@X@@QAE@XZ

Example:

// foo.hpp

#pragma once

template <class>
struct X {
    ~X() {}
};

struct Y : virtual X<void> {
    ~Y();
};

// a.cpp

#include "foo.hpp"

extern "C" void start()
{
    Y* y;
    y->~Y();
}

// b.cpp

#include "foo.hpp"

Y::~Y() {}

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to