aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2023-02-15 13:32:57 +0000
committerJonathan Wakely <jwakely@redhat.com>2023-02-16 12:35:13 +0000
commitd82490d531272f50202b663400cfa814335a11f2 (patch)
treef76f2002d9ba6fd73bf7e08678395bbaa89d883d
parentb81b017ed30b8c6abb2e58a3ed9eb67eccc1c181 (diff)
downloadgcc-d82490d531272f50202b663400cfa814335a11f2.zip
gcc-d82490d531272f50202b663400cfa814335a11f2.tar.gz
gcc-d82490d531272f50202b663400cfa814335a11f2.tar.bz2
doc: Suggest fix for -Woverloaded-virtual warnings
Users are confused about what this warning means, so add a suggested solution to the documentation. gcc/ChangeLog: * doc/invoke.texi (C++ Dialect Options): Suggest adding a using-declaration to unhide functions.
-rw-r--r--gcc/doc/invoke.texi4
1 files changed, 4 insertions, 0 deletions
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 0a43720..6def1fd 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -4282,6 +4282,10 @@ b->f();
@noindent
fails to compile.
+In cases where the different signatures are not an accident, the
+simplest solution is to add a using-declaration to the derived class
+to un-hide the base function, e.g. add @code{using A::f;} to @code{B}.
+
The optional level suffix controls the behavior when all the
declarations in the derived class override virtual functions in the
base class, even if not all of the base functions are overridden: