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: "micis at gmx dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 11 Mar 2005 17:30:02 -0000
- Subject: [Bug c++/20423] Warning -Woverloaded-virtual triggers to often
- References: <20050311103418.20423.micis@gmx.de>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From micis at gmx dot de 2005-03-11 17:30 -------
I think there a two different situations:
1) in the derived class you define a method with the same name but
different parameters.
This is typically a serious bug in your program which can result in the
exectution of the code of the wrong (not overloaded) function.
2) in the derived class you define not all overloaded variants.
In that case the not overloaded variants are hidden but no run-time-error
occurs. If you try to call a hidden variant, the compiler complains.
If "-Woverloaded-virtual" only triggers in case 1, it could be enabled
with "-Wall" as it typically indicates a severe bug in your program.
If there would be a "-Wpartial-overloaded-virtual" you could enable if you like
it and you can. I have to work with a large existing code basis where I would
not enable it.
I think to give different messages like ICC is the way to go.
Michael Cieslinski
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20423