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

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Oct 31 11:20:50 PDT 2016


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

Richard Smith <richard-llvm at metafoo.co.uk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |richard-llvm at metafoo.co.uk
         Resolution|---                         |FIXED

--- Comment #3 from Richard Smith <richard-llvm at metafoo.co.uk> ---
(In reply to comment #1)
> Not sure why GCC accepts it... GCC certainly thinks its deleted.

Based on how it diagnoses problems, I think GCC doesn't have any way to check
whether a special member should be deleted other than trying to define it. As a
result, I'd guess that its representation of the function doesn't mark it as
deleted, which is probably how its check for "deleted function overrides
non-deleted function" misses this case.

Anyway, I improved the diagnostic in r285610, and we now report:

<stdin>:8:5: error: deleted function '~Derived' cannot override a non-deleted
function
    ~Derived() override = default;
    ^
<stdin>:3:13: note: overridden virtual function is here
    virtual ~Base() = default;
            ^
<stdin>:6:17: note: destructor of 'Derived' is implicitly deleted because base
class 'Base' has an inaccessible destructor
class Derived : public Base
                ^

... which should hopefully prevent anyone else from being confused as to why we
would reject this.

-- 
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/589f13b7/attachment.html>


More information about the llvm-bugs mailing list