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

            Bug ID: 32837
           Summary: virtual destructor not called
           Product: clang
           Version: 4.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected]

the S2::~S2() is not called in the following code. This is easiest to see by
compiling with -O because main is optimized to return 0 and do nothing else.

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

struct S2 : public S
{
    virtual ~S2()
    {
        __builtin_printf("never reached\n");
    }
};

int main()
{
    delete [] static_cast<S *>(new S2[1]);
}

clang version 4.0.0 (tags/RELEASE_400/final 299826)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /opt/compiler-explorer/clang-4.0.0/bin

See: https://godbolt.org/g/SlDwMr

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

Reply via email to