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

Kaelyn Uhrain <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |[email protected]
         Resolution|                            |FIXED

--- Comment #2 from Kaelyn Uhrain <[email protected]> 2012-06-22 16:15:23 CDT ---
Not sure when it was added, but in the 3.1 release clang has
-Woverloaded-virtual that is off by default and enabled by -Wall that will warn
on the example given:

$ cat tmp.cc 
#include <cstdio>

class foo {
public:
  virtual void f() { printf("foo\n"); }
  virtual void g() const { printf("foo\n"); }
};

class bar : public foo {
public:
  void f() const { printf("bar\n"); }
  void g() const { printf("bar\n"); }
};

int main() {
  foo *b = new bar();
  b->f();
  b->g();
  return 0;
}


$ clang++ -Wall -fsyntax-only tmp.cc 
tmp.cc:11:8: warning: 'bar::f' hides overloaded virtual function
[-Woverloaded-virtual]
  void f() const { printf("bar\n"); }
       ^
tmp.cc:5:16: note: hidden overloaded virtual function 'foo::f' declared here
  virtual void f() { printf("foo\n"); }
               ^
1 warning generated.

-- 
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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to