This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/20710] g++ should warn when hiding non-virtual method in base class
- From: "tromey at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 30 Jan 2015 16:58:29 +0000
- Subject: [Bug c++/20710] g++ should warn when hiding non-virtual method in base class
- Auto-submitted: auto-generated
- References: <bug-20710-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=20710
Tom Tromey <tromey at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |tromey at gcc dot gnu.org
--- Comment #8 from Tom Tromey <tromey at gcc dot gnu.org> ---
It would be nice to have a way to prevent hiding.
See the partial example in bug 64877. Here, gcc 5
warns about the construct used to prevent hiding.
However, "final" will not work as the function in question
is non-virtual.
The class in question is a base class, so it seems rather
strange to make the function "virtual final". And, while
not an issue in this particular case, that would in some
cases introduce a vtable where none was previously needed.