This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]