[PATCH] -Woverloaded-virtual

Aaron Ballman aaron at aaronballman.com
Wed Jul 30 15:54:38 PDT 2014


On Wed, Jul 30, 2014 at 6:31 PM, David Blaikie <dblaikie at gmail.com> wrote:
> I think something pithier might be helpful (while your comment is
> correct, I found it a little hard to follow the motivations, etc) -
> spitballing:
>
> Here Clang deviates from GCC by only diagnosing overloads of inherited
> virtual function that do not override any other virtual functions in
> the base.
> GCC's -Woverloaded-virtual is more about any case of derived functions
> hiding base functions and doesn't seem specific to virtual functions.
> The cases GCC catches that Clang does not may be better served by a
> general warning on call sites that, had the base function been
> visible, would've called that function. This would avoid false
> positives such as warning on base::func() + derived::func(int) where
> callers are unlikely to call the latter when they intended the former
> (and Clang's typo correction can correct derived::func() to
> base::func() already).
>
> Maybe that's too much of a rant. I'm not sure how much detail to give,
> really... The last sentence there, while useful, is perhaps too much
> detail - maybe it'd be better served by an example in a test case
> somewhere with a FIXME of "warn here"? (and/or, as you say, a bug
> filed)

I took the last sentence out as it seemed a bit too specific, and
changed the wording around slightly. I like the idea of a FIXME, so I
made an example and added it to a test case. Think this looks
reasonable?

Thanks!

~Aaron
-------------- next part --------------
A non-text attachment was scrubbed...
Name: virtual.patch
Type: application/octet-stream
Size: 1955 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140730/b8a56719/attachment.obj>


More information about the cfe-commits mailing list