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.133.124]) by sourceware.org (Postfix) with ESMTPS id E58EA3857355 for ; Mon, 16 May 2022 16:19:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E58EA3857355 Received: from mail-yb1-f199.google.com (mail-yb1-f199.google.com [209.85.219.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-252-deHchrtIPCOmg2X-Sh_PRg-1; Mon, 16 May 2022 12:19:47 -0400 X-MC-Unique: deHchrtIPCOmg2X-Sh_PRg-1 Received: by mail-yb1-f199.google.com with SMTP id a144-20020a25ca96000000b0064d6e10dd6aso4572844ybg.1 for ; Mon, 16 May 2022 09:19:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=laUj8pnS89f3THzayxJupDMxXPXsYrVkeGGppMQNKqk=; b=XvmjQwRkCNydOPByynt+zsq5wKKu5tpXlpaZ76XjYtGV5NgzvLIAtqT0m6r4bUganA 1OlEi4fJK6JBBVvwoCKamjeL91tc9WE2sULfSLWLYuLG234PuYbqS4UF9NITS/pB5T06 iLIlX9fUr5fX9Ou/fVsXjYG2FH2BL/fhO2ACcH91rGxT77JFW/FpzTDl4eY6tXoRRuO/ yVw/RaA9n0w0bPsC0kRk0UVUn7vfdooUaDKu+GKJtmKowCqBN5U2//LrJ4+iUflvoIkW fEmQ9QlU4kUJmIekRaIxSbHluO+csjgsBGSoqyqDtqkNBZGIChsgp9k80bmoxCeg3fAf Ndkw== X-Gm-Message-State: AOAM5334DFaXixedFshwJabwesEGgrItIDiNaOSrZaooX8wQtm129UZr r9aAdggxB4nRNp4ZPRBRILapLymmdCzZKoSUOZlAmH8EWFD+DQkBtBitMFz9tXX1LzEiG2NaP1r SM6uaqXk7TajRdnDgKsn++4S24Vwi4Z8= X-Received: by 2002:a25:d9d8:0:b0:64d:c36a:8de with SMTP id q207-20020a25d9d8000000b0064dc36a08demr3839518ybg.404.1652717986940; Mon, 16 May 2022 09:19:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxk7iKuQtpuxLc8QCbxEzpg6li5QyHBivsczzJBOT79fkEYZS3k9UbKOMkTeRDZDf2YXCvdb4H1QZQ14hU52cU= X-Received: by 2002:a25:d9d8:0:b0:64d:c36a:8de with SMTP id q207-20020a25d9d8000000b0064dc36a08demr3839499ybg.404.1652717986707; Mon, 16 May 2022 09:19:46 -0700 (PDT) MIME-Version: 1.0 References: <20220513124050.4028450-1-jwakely@redhat.com> <20220513124050.4028450-3-jwakely@redhat.com> <65a5eb4c-8c9e-4bc6-846a-a06b1f6d5c1e@gmail.com> <005d0911-4fb6-f14a-a23a-2ff26774bfd6@gmail.com> In-Reply-To: <005d0911-4fb6-f14a-a23a-2ff26774bfd6@gmail.com> From: Jonathan Wakely Date: Mon, 16 May 2022 17:19:35 +0100 Message-ID: Subject: Re: [committed 03/12] libstdc++: Add macros for the inline namespace std::_V2 To: =?UTF-8?Q?Fran=C3=A7ois_Dumont?= Cc: "libstdc++" X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-6.6 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, KAM_NUMSUBJECT, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libstdc++@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libstdc++ mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 May 2022 16:19:50 -0000 On Mon, 16 May 2022 at 05:28, Fran=C3=A7ois Dumont via Libstdc++ wrote: > > Based on what you told me recently maybe this patch is better. It does > not change the link errors. We need to be a little careful about just removing those macros. For definitions that use qualified names, the macros are not needed. For example: namespace std { inline namespace __8 { struct foo { void bar(); // #1 }; } } namespace std { void foo::bar() { } // #2 } The definition at #2 works correctly, because name lookup for 'foo' finds std::__8::foo, so it's a definition of the member declared at #1. But if we have a definition using an unqualified name, that doesn't work the same. For example: namespace std { inline namespace __8 { void func(); // #3 } } namespace std { void func() { } // #4 } The definition at #4 doesn't need to do any name lookup, so it just defines (and declares) a new function directly in namespace std. This means we have std::__8::func declared at #3 and std::func declared at #4, and so trying to call std::func() would be ambiguous. So we don't need to _add_ the macros to files where the symbols are already being defined correctly (which is why your recent patch was not needed). And we can remove them from _some_ source files. But if we remove all source files, some of those removals would be wrong.