From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id BBD933858D35 for ; Wed, 15 Feb 2023 13:37:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BBD933858D35 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1676468273; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Y2ynO+j382JXZvLDV1XRLW/RBPSdDSkM52rrsGmDwwM=; b=f4MfFRUtYp+DPhmhqBZkIc0H1rAKX0BUmxw9QFC0zIB18WtCtrx7/y9g0D9eCMpYEMjSMJ DZH7LkWutH+Cwe3GlOnInaMIPNcPXoasKSz/IGiUNkc9X8EUy2DU70fb6wWzFIvX7DmU9w HoAS037DFLiImPIlZiLfCOzkRE3X+LA= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-605-ai8Oca5QOfW9UCgAJgJBBw-1; Wed, 15 Feb 2023 08:37:51 -0500 X-MC-Unique: ai8Oca5QOfW9UCgAJgJBBw-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 59FCD3C10141 for ; Wed, 15 Feb 2023 13:37:51 +0000 (UTC) Received: from localhost (unknown [10.33.37.21]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1C2EB40C1423; Wed, 15 Feb 2023 13:37:50 +0000 (UTC) From: Jonathan Wakely To: gcc-patches@gcc.gnu.org Cc: Jason Merrill Subject: [PATCH] doc: Suggest fix for -Woverloaded-virtual warnings Date: Wed, 15 Feb 2023 13:37:50 +0000 Message-Id: <20230215133750.15537-1-jwakely@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-12.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: OK for trunk? -- >8 -- 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. --- gcc/doc/invoke.texi | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 26de582e41e..6404ed5c4ff 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: -- 2.39.1