[llvm-bugs] [Bug 38521] New: [Microsoft ABI] Inline destructors are not emitted when a virtual subclass's complete destructor is used

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Aug 10 06:59:47 PDT 2018


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: unassignedclangbugs at nondot.org
          Reporter: ngg at tresorit.com
                CC: llvm-bugs at 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 at X@@QAE at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180810/e80e377c/attachment.html>


More information about the llvm-bugs mailing list