[llvm-bugs] [Bug 25258] New: -Wnon-virtual-dtor should not trigger if the base class has a protected destructor

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Oct 20 01:04:55 PDT 2015


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

            Bug ID: 25258
           Summary: -Wnon-virtual-dtor should not trigger if the base
                    class has a protected destructor
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: klimek at google.com
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org
    Classification: Unclassified

struct A { virtual void a(); protected: ~A() = default; };
struct B : public A { void a() override; };

/tmp/t.cc:2:8: warning: 'B' has virtual functions but non-virtual destructor
[-Wnon-virtual-dtor]
struct B : public A { void a() override; };
       ^
1 warning generated.

As there is no way to destruct a B object through an A pointer, this should be
allowed.

-- 
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/20151020/7332934e/attachment.html>


More information about the llvm-bugs mailing list