From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2181) id 3FAD03858D33; Thu, 16 Feb 2023 12:35:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3FAD03858D33 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1676550958; bh=g8ebyqc2KjfD25Mg7TMqwRuE8teMKXVtM6xi9K+Du6g=; h=From:To:Subject:Date:From; b=Iw27ATK/C8yndEdFA9pIs0ZsQtvqS0I/HvbP1sBnTHeHa63F5ZP4hDvcUPNvkKW+U ZyPw4Ks3owN8CXcDXISGRLNvY4KLlfT+vdxlmngDpI+O6GvO8S7gAIjQOuGB8uvo7E 5q7SI/kPHMq2/+pfgWFprkdrhVn8ykfmR9FL+61k= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Jonathan Wakely To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-6081] doc: Suggest fix for -Woverloaded-virtual warnings X-Act-Checkin: gcc X-Git-Author: Jonathan Wakely X-Git-Refname: refs/heads/master X-Git-Oldrev: b81b017ed30b8c6abb2e58a3ed9eb67eccc1c181 X-Git-Newrev: d82490d531272f50202b663400cfa814335a11f2 Message-Id: <20230216123558.3FAD03858D33@sourceware.org> Date: Thu, 16 Feb 2023 12:35:58 +0000 (GMT) List-Id: https://gcc.gnu.org/g:d82490d531272f50202b663400cfa814335a11f2 commit r13-6081-gd82490d531272f50202b663400cfa814335a11f2 Author: Jonathan Wakely Date: Wed Feb 15 13:32:57 2023 +0000 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. Diff: --- gcc/doc/invoke.texi | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 0a43720f614..6def1fd631e 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: