[Bug c++/20423] Warning -Woverloaded-virtual triggers to often

jwakely dot gcc at gmail dot com gcc-bugzilla@gcc.gnu.org
Tue Jul 21 17:36:00 GMT 2009



------- Comment #9 from jwakely dot gcc at gmail dot com  2009-07-21 17:36 -------
(In reply to comment #0)
> 
> This is also not conforming to the "specification" in
> http://gcc.gnu.org/ml/gcc-bugs/1999-08n/msg01069.html
> 
>   Warn when a derived class function declaration may be an error in
>   defining a virtual function.  In a derived class, the definitions of
>   virtual functions must match the type signature of a virtual
>   function declared in the base class.  With this option, the compiler
>   warns when you define a function with the same name as a virtual
>   function, but with a type signature that does not match any
>   declarations from the base class.

But that's not what it does. The description in the manual describes the
current behaviour correctly, that description above doesn't.

(In reply to comment #6)
> A really wild-guess patch. Comments?
...
> +                   /* If at least one method has the same signature,
> +                      the not overloaded variants are just
> +                      hidden.  */
> +                   just_hidden = true;

Shouldn't this say "not overridden variants" ?

I don't like the name -Wpartial-overloaded-virtual for the same reason. The
name should clearly distinguish whether it is triggered by overloading,
overriding or hiding.

-Woverloaded-virtual is a reasonable name for the current behaviour; it
triggers if there is an overload that hides a virtual (whether the overload is
itself virtual or not.)  The proposed -Wpartial-overloaded-virtual name makes
no sense.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20423



More information about the Gcc-bugs mailing list