[llvm-bugs] [Bug 30844] New: Using override on a overridden destructor produces an error

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Oct 31 04:36:15 PDT 2016


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

            Bug ID: 30844
           Summary: Using override on a overridden destructor produces an
                    error
           Product: clang
           Version: 3.8
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: unassignedclangbugs at nondot.org
          Reporter: vanboxem.ruben at gmail.com
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org
    Classification: Unclassified

This code:

class Base
{
    virtual ~Base() = default;
};

class Derived : public Base
{
    ~Derived() override = default;
};

Produces this nonsensical error:
main.cpp:9:5: error: deleted function '~Derived' cannot override a non-deleted
function
    ~Derived() override = default;
    ^
main.cpp:4:13: note: overridden virtual function is here
    virtual ~Base() = default;
            ^
1 error generated.

This is just plain wrong. GCC accepts this code. Override is possible on a
virtual destructor, and is a useful tool to actually detect if the destructor
of inherited classes is properly virtual (although the check only goes one
level deep).

-- 
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/20161031/f73dc36d/attachment.html>


More information about the llvm-bugs mailing list