[LLVMbugs] [Bug 8168] New: Clang accepts static functions that would override virtual ones

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Sep 16 11:22:49 PDT 2010


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

           Summary: Clang accepts static functions that would override
                    virtual ones
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: sebastian.redl at getdesigned.at
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com


class A {
public:
  virtual void foo() {}
};

class B : public A {
public:
  static void foo() {}
};



The standard says ([class.virtual]p2) that any function with the same name,
parameter-type-list, cv- and ref-qualifier as a virtual one in a base class
overrides the base version and is virtual itself. It does not exclude static
members from this, and so B::foo above would end up both static and virtual,
which is not allowed. Both G++ and EDG reject the sample, but Clang accepts it.

-- 
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