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 13D173856DDD for ; Tue, 16 May 2023 11:23:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 13D173856DDD 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=1684236217; 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: in-reply-to:in-reply-to:references:references; bh=G/xnXMtUhSUTegBrkUHjSHSdIxFLWGdxAS0ZnsXHixw=; b=Dv929ABx6BksuhL/qeqKfq/gXafBj+wx1UmsLB0Z7rbonIGCLpB3l/YzdnFh9g89E2zrsE wfP4aOlOR8pz1Gt/3iP9hmmTxCu7H8WM+7yIZDe1Y80VgF5/df/eh/nUIGN1f+i9wLRS03 sbbJGYobb2Rlj7s4n/1cNnU2vcsTJtQ= Received: from mail-lj1-f198.google.com (mail-lj1-f198.google.com [209.85.208.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-342-d_E-PaVHPsOt9mSzWKvuVg-1; Tue, 16 May 2023 07:23:35 -0400 X-MC-Unique: d_E-PaVHPsOt9mSzWKvuVg-1 Received: by mail-lj1-f198.google.com with SMTP id 38308e7fff4ca-2ac8557cdb6so62506921fa.2 for ; Tue, 16 May 2023 04:23:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684236214; x=1686828214; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=G/xnXMtUhSUTegBrkUHjSHSdIxFLWGdxAS0ZnsXHixw=; b=PDuOtxC71TVClSrj5I85GxsENXd5mdPi36EQCZDjZpc63sUMirHVNwXAVIdlvu0vFy XZgSIpSSc5Zu1+cIDWGSu/ao7ZGO2EqHrvoHaNOaCKYi0JqMFyt5hotWtuVhH4xu5eMo vMIYopr7eeqGXty0s+ZcmzwMI2iZKflEVdLkX5J3v6e1rGxbzOTN+FFabUj7yv0IVzra km+7FKWqFwfuI9glmpM+tR4sL4X+a0oAItvj4hLbn6oeRPG4YMBCZh2Rzm2SAjeFFG1/ fUV9bYsAT0npZD9RnQhnuWes0ObQjayO3VLYPQrSoRFid14NwocnB3/zbpkLWq1UQfAn /YxQ== X-Gm-Message-State: AC+VfDzCgBt3fveNIMo6mtFyr6S+o6ePYWvLsS5N2RFEE9ZfnWiqUc6b cMwfHgGhmSyetE6Kivq4bWcDpGUf41JrFnx7aCaFsz9xnJn8eRLIz5hhfTGk5CU4P0vX2E0Iuao 86OrN7iX+9i11ayNRiXXmn/Mx5JP9n10= X-Received: by 2002:a2e:a282:0:b0:2ad:95ba:a5d with SMTP id k2-20020a2ea282000000b002ad95ba0a5dmr7365119lja.43.1684236214372; Tue, 16 May 2023 04:23:34 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7oXE+3HjDNj7eQIeEKjogIhXFi0j5w7sJuQkXP1rQz8Jrm87gugqU9XCKletukqfyPfXm3bcQZuI0c1xAqbAA= X-Received: by 2002:a2e:a282:0:b0:2ad:95ba:a5d with SMTP id k2-20020a2ea282000000b002ad95ba0a5dmr7365111lja.43.1684236214040; Tue, 16 May 2023 04:23:34 -0700 (PDT) MIME-Version: 1.0 References: <20220908183010.3290473-1-jwakely@redhat.com> In-Reply-To: <20220908183010.3290473-1-jwakely@redhat.com> From: Jonathan Wakely Date: Tue, 16 May 2023 12:23:22 +0100 Message-ID: Subject: Re: [committed] libstdc++: Find make_error_code and make_error_condition via ADL only To: Jonathan Wakely Cc: libstdc++@gcc.gnu.org X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: multipart/alternative; boundary="00000000000041967d05fbcdcdf3" X-Spam-Status: No, score=-12.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,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 List-Id: --00000000000041967d05fbcdcdf3 Content-Type: text/plain; charset="UTF-8" For the record (i.e. so I don't have to remember/rediscover this), I tried to backport this change to gcc-11 but it doesn't work on that branch because of PR 68942 ("overly strict use of deleted function before argument-dependent lookup (ADL)"). We can live with it being a gcc-12+ feature. On Thu, 8 Sept 2022 at 19:30, Jonathan Wakely wrote: > Tested powerpc64le-linux, pushed to trunk. > > -- >8 -- > > The new proposed resolution for LWG 3629 says that std::error_code and > std::error_condition should only use ADL to find their customization > points. This means we need to use a poison pill to prevent lookup from > finding overloads in the enclosing namespaces. > > We can also remove the forward declarations of std::make_error_code and > std::make_error_condition, because they aren't needed now. ADL can find > them anyway (when std is an associated namespace), and unqualified name > lookup will not (and should not) find them. > > libstdc++-v3/ChangeLog: > > * include/std/system_error (__adl_only::make_error_code): Add > deleted function. > (__adl_only::make_error_condition): Likewise. > (error_code::error_code(ErrorCodeEnum)): Add using-declaration > for deleted function. > (error_condition::error_condition(ErrorConditionEnum)): > Likewise. > * testsuite/19_diagnostics/error_code/cons/lwg3629.cc: New test. > * testsuite/19_diagnostics/error_condition/cons/lwg3629.cc: New > test. > --- > libstdc++-v3/include/std/system_error | 18 +++++-- > .../19_diagnostics/error_code/cons/lwg3629.cc | 48 +++++++++++++++++++ > .../error_condition/cons/lwg3629.cc | 48 +++++++++++++++++++ > 3 files changed, 109 insertions(+), 5 deletions(-) > create mode 100644 > libstdc++-v3/testsuite/19_diagnostics/error_code/cons/lwg3629.cc > create mode 100644 > libstdc++-v3/testsuite/19_diagnostics/error_condition/cons/lwg3629.cc > > diff --git a/libstdc++-v3/include/std/system_error > b/libstdc++-v3/include/std/system_error > index 050439427cc..e12bb2f0e1e 100644 > --- a/libstdc++-v3/include/std/system_error > +++ b/libstdc++-v3/include/std/system_error > @@ -195,7 +195,11 @@ _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2) > * @{ > */ > > - error_code make_error_code(errc) noexcept; > +namespace __adl_only > +{ > + void make_error_code() = delete; > + void make_error_condition() = delete; > +} > > /** Class error_code > * > @@ -231,7 +235,10 @@ _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2) > template typename = _Check<_ErrorCodeEnum>> > error_code(_ErrorCodeEnum __e) noexcept > - { *this = make_error_code(__e); } > + { > + using __adl_only::make_error_code; > + *this = make_error_code(__e); > + } > > error_code(const error_code&) = default; > error_code& operator=(const error_code&) = default; > @@ -330,8 +337,6 @@ _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2) > operator<<(basic_ostream<_CharT, _Traits>& __os, const error_code& > __e) > { return (__os << __e.category().name() << ':' << __e.value()); } > > - error_condition make_error_condition(errc) noexcept; > - > /** Class error_condition > * > * This class represents error conditions that may be visible at an API > @@ -363,7 +368,10 @@ _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2) > template typename = _Check<_ErrorConditionEnum>> > error_condition(_ErrorConditionEnum __e) noexcept > - { *this = make_error_condition(__e); } > + { > + using __adl_only::make_error_condition; > + *this = make_error_condition(__e); > + } > > error_condition(const error_condition&) = default; > error_condition& operator=(const error_condition&) = default; > > --00000000000041967d05fbcdcdf3--