[Bug c++/57854] Would like to have a warning for virtual overrides without C++11 "override" keyword
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57854 Marek Polacek changed: What|Removed |Added Status|UNCONFIRMED |RESOLVED CC||mpolacek at gcc dot gnu.org Resolution|--- |FIXED --- Comment #7 from Marek Polacek --- -Wsuggest-override is already present, closing.
[Bug c++/57854] Would like to have a warning for virtual overrides without C++11 "override" keyword
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57854 Nachchanged: What|Removed |Added CC||nachms+gcc at gmail dot com --- Comment #6 from Nach --- (In reply to Jonathan Wakely from comment #2) > (In reply to Thiago Macieira from comment #0) > > > > It should be in -Weffc++. > > Not unless a new C++11 edition of Effective C++ recommends using override on > all overriding functions, and not unless we update -Weffc++ to correspond to > something other than the first edition. > Modern Effective C++ Item 12 is that every virtual derived function should make use of the override keyword. Therefore, -Weffc++ should now include this new warning.
[Bug c++/57854] Would like to have a warning for virtual overrides without C++11 override keyword
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57854 --- Comment #5 from Ville Voutilainen ville.voutilainen at gmail dot com --- It seems to me that https://gcc.gnu.org/viewcvs/gcc?view=revisionrevision=219213 implements the desired functionality. Can we close this bug?
[Bug c++/57854] Would like to have a warning for virtual overrides without C++11 override keyword
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57854 Ville Voutilainen ville.voutilainen at gmail dot com changed: What|Removed |Added CC||ville.voutilainen at gmail dot com --- Comment #4 from Ville Voutilainen ville.voutilainen at gmail dot com --- We now have -Wsuggest-final-methods, so having something like -Wsuggest-override wouldn't be far-fetched.
[Bug c++/57854] Would like to have a warning for virtual overrides without C++11 override keyword
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57854 Manuel López-Ibáñez manu at gcc dot gnu.org changed: What|Removed |Added CC||jason at gcc dot gnu.org, ||manu at gcc dot gnu.org --- Comment #1 from Manuel López-Ibáñez manu at gcc dot gnu.org --- (In reply to Thiago Macieira from comment #0) I would like a new (optional) warning that would point out every C++ virtual override that is done without the C++11 keyword that indicates an override. By necessity, this warning would only be permitted in C++11 mode. Hi Thiago, I am so grateful for KDE that I would like to help here if possible. But I would like to ask the C++ maintainer whether this is something that would be accepted in mainline G++ and whether G++ has the capabilities to detect this easily. Jason, what do you think? Perhaps the same issues that made [[base_check]] to be dropped would affect the implementation of this warning? I don't know the specifics.
[Bug c++/57854] Would like to have a warning for virtual overrides without C++11 override keyword
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57854 --- Comment #2 from Jonathan Wakely redi at gcc dot gnu.org --- (In reply to Thiago Macieira from comment #0) It should be in -Weffc++. Not unless a new C++11 edition of Effective C++ recommends using override on all overriding functions, and not unless we update -Weffc++ to correspond to something other than the first edition. This seems like something that would fit better into a plugin than the core compiler.
[Bug c++/57854] Would like to have a warning for virtual overrides without C++11 override keyword
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57854 --- Comment #3 from Manuel López-Ibáñez manu at gcc dot gnu.org --- (In reply to Jonathan Wakely from comment #2) (In reply to Thiago Macieira from comment #0) It should be in -Weffc++. Not unless a new C++11 edition of Effective C++ recommends using override on all overriding functions, and not unless we update -Weffc++ to correspond to something other than the first edition. This seems like something that would fit better into a plugin than the core compiler. We could add a new option -Wbase-check, no? Or we could also write a plugin and distribute it with GCC. I think it is something that could be generally used and an useful example of how to write plugins (and a testcase testing the plugin infrastructure).