This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/20423] Warning -Woverloaded-virtual triggers to often
- From: "jwakely dot gcc at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 21 Jul 2009 17:36:05 -0000
- Subject: [Bug c++/20423] Warning -Woverloaded-virtual triggers to often
- References: <bug-20423-7559@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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