[LLVMbugs] [Bug 11564] New: Incorrect warning about hidden overloaded virtual function with virtual inheritance

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Dec 14 02:13:45 PST 2011


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

             Bug #: 11564
           Summary: Incorrect warning about hidden overloaded virtual
                    function with virtual inheritance
           Product: clang
           Version: 3.0
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: zhezherun at yandex.ru
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


The following code generates a warning in clang 3.0:


struct A {
    virtual ~A() {}
    virtual void func(int) = 0;
};

struct B {
    virtual ~B() {}
    virtual void func(double) = 0;
};

struct Base: public virtual A {
    virtual void func(int) {}
};

struct Derived: public Base, virtual public A, virtual public B {
    virtual void func(int) {}
    virtual void func(double) {}
};

int main() {
    Derived d;
    d.func(1);
    d.func(1.0);
}


./clang++ -Wall -o test test.cpp
test.cpp:17:18: warning: 'Derived::func' hides overloaded virtual function
[-Woverloaded-virtual]
    virtual void func(double) {}
                 ^
test.cpp:3:18: note: hidden overloaded virtual function 'A::func' declared here
    virtual void func(int) = 0;
                 ^
1 warning generated.


Note that func(int) is implemented in Derived, so it is not hidden and the
warning is incorrect. gcc 4.6.2 processes this example correctly and does not
generate any warnings.

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