From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 6FE213851407; Mon, 12 Sep 2022 16:09:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6FE213851407 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1662998998; bh=CKRj/awb9XeuTya2wDwutpQB54awrnoc0pQ/Lx6BJ+0=; h=From:To:Subject:Date:In-Reply-To:References:From; b=UundPkDyz1FHjGbjxmhVhSjBCmz4RTONx5DZQ4QWw4UN1xjWogOIAn69flGApSZQ6 DnhkywyKQVHueBa8H4iX3NNXgXWZwkozXxGqFSxEPBewQk4PR9dM3vHCvATIvOHNze aLYm575TZMMiO0UKpqg8HVm2IDvlVsnGEvDEXnXg= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/86491] bogus and unsuppressible warning: 'YYY' has a base 'ZZZ' whose type uses the anonymous namespace Date: Mon, 12 Sep 2022 16:09:57 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: unknown X-Bugzilla-Keywords: diagnostic, patch X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: redi at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D86491 --- Comment #14 from CVS Commits --- The master branch has been updated by Jason Merrill : https://gcc.gnu.org/g:8ef5fa4c56c82dfbd6e8fc5e4e08c4be843abc3e commit r13-2627-g8ef5fa4c56c82dfbd6e8fc5e4e08c4be843abc3e Author: Jonathan Wakely Date: Thu Jun 30 17:53:26 2022 +0100 c++: Refer to internal linkage for -Wsubobject-linkage [PR86491] Since C++11 relaxed the requirement for template arguments to have external linkage, it's possible to get -Wsubobject-linkage warnings without using any anonymous namespaces. This confuses users when they get diagnostics that refer to an anonymous namespace that doesn't exist in their code. This changes the diagnostic to say "has internal linkage" for C++11 and later, if the type isn't actually a member of the anonymous namespace. Making that distinction involved renaming the current decl_anon_ns_mem_= p to something that better expresses its semantics. For C++98 template arguments declared with 'static' are ill-formed anyway, so the only way this warning can arise is via anonymous namespaces. That means the existing wording is accurate for C++98 and so we can keep it. PR c++/86491 gcc/cp/ChangeLog: * decl2.cc (constrain_class_visibility): Adjust wording of -Wsubobject-linkage for cases where anonymous namespaces aren't used. * tree.cc (decl_anon_ns_mem_p): Now only true for actual anonym= ous namespace members, rename old semantics to... (decl_internal_context_p): ...this. * cp-tree.h, name-lookup.cc, pt.cc: Adjust. gcc/testsuite/ChangeLog: * g++.dg/warn/anonymous-namespace-3.C: Use separate dg-warning directives for C++98 and everything else. * g++.dg/warn/Wsubobject-linkage-5.C: New test.=