[LLVMbugs] [Bug 13890] New: Final abstract classes should generate warnings

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Sep 20 15:38:46 PDT 2012


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

             Bug #: 13890
           Summary: Final abstract classes should generate warnings
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++11
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: pete.cooper at gmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified


class Animal {
  virtual void print() const = 0;
};
class Dog final : public Animal {
};

In this code, i would expect a compiler warning as Dog is final, but is still
abstract as it didn't implement a print method.  Its also possible to put final
on Animal itself which doesn't really make sense as then Animal is an abstract
class which cannot be implemented by anyone.

-Wall doesn't show anything for this test.  -Weverything does, but the messages
aren't related to this:

cpp11.cpp:1:7: warning: 'Animal' has virtual functions but non-virtual
      destructor [-Wnon-virtual-dtor]
class Animal {
      ^
cpp11.cpp:4:11: warning: 'final' keyword is incompatible with C++98
      [-Wc++98-compat]
class Dog final : public Animal {
          ^
cpp11.cpp:4:7: warning: 'Dog' has virtual functions but non-virtual destructor
      [-Wnon-virtual-dtor]
class Dog final : public Animal {

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list