Have you tested this on a large codebase? clang's -Woverloaded-virtual has been tweaked to have an acceptable noise level. gcc's version of the warning is uselessly noisy; clang's version is always one of its best diagnostics when I run it on a codebase that hasn't been built with clang before.
On Wed, Jul 30, 2014 at 1:30 PM, Aaron Ballman <[email protected]> wrote: > I believe the following patch addresses a slight deficiency in our > -Woverloaded-virtual warning check. Specifically, it causes the > following code to warn (which matches GCC's behavior): > > struct base { > virtual void foo(int I) {} > virtual void foo(char C) {} > }; > > struct derived : public base { > void foo(int I2) override {} > }; > > It does this by continuing to check other methods instead of early > returning out of processing them when an exact signature match is > encountered. I believe this is an improvement because it catches > problems like: > > derived d; > d.foo('1'); > > Where derived::foo(int) is called when the user may expect > base::foo(char) to be called. > > ~Aaron > > _______________________________________________ > cfe-commits mailing list > [email protected] > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits > >
_______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
