[LLVMbugs] [Bug 20729] New: Explicit base destructor call rejected

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Aug 21 16:59:32 PDT 2014


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

            Bug ID: 20729
           Summary: Explicit base destructor call rejected
           Product: clang
           Version: 3.4
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: david_work at me.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

#include <new>

struct b {
        virtual ~ b() {}
};

struct d : b {
        ~ d () {}
};

int main() {
        d o;
        o.~b();
        new( & o ) d;
}


This is well formed but gets a diagnosis "destructor type 'b' in object
destruction expression does not match the type 'd' of the object being
destroyed".

The most applicable rule is §12.4/13:

… if the object is not of the destructor’s class type and not of a class
derived from the destructor’s class type (including when the destructor is
invoked via a null pointer value), the program has undefined behavior.

-- 
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/20140821/c6875f71/attachment.html>


More information about the llvm-bugs mailing list