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: unassignedclangb...@nondot.org
          Reporter: vanboxem.ru...@gmail.com
                CC: dgre...@apple.com, llvm-bugs@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to