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

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


// foo.hpp

#pragma once

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

struct Y : virtual X<void> {

// a.cpp

#include "foo.hpp"

extern "C" void start()
    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

Reply via email to