From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) by sourceware.org (Postfix) with ESMTPS id B41C03857011; Mon, 12 Sep 2022 10:55:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B41C03857011 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pj1-x1030.google.com with SMTP id s14-20020a17090a6e4e00b0020057c70943so11957506pjm.1; Mon, 12 Sep 2022 03:55:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date; bh=UZ64YbX1IeQVQAPBdpjBcwK7uTLpgWnj3oDS28Ko4Qc=; b=NRl7ztBtvwO683kR2zqHP+B6GeDH142zWCEst28pk5FSsQoR2Pc421C5rkfj0kHJwT yGjud2QvEO6NDi7j08gwqco7sUAXZnrOTzH9QKUr45h5Dk8ZFXBloy3PjluL8Z6uwCka lngmKUUFbjHrYwmGpkL0+RB+hkPClL8vEMjviHeWbBD9UhZsk6pYVWZMgfg9iO92A4xv xZ3SrQXo6htLoLW3sI/vncGXKybd8/NrCkEsM1M4RHqmQGaRHoBGDe8lsG709gG8AWn8 smN0QkJ9toipXT2kNhlncTIWdldnXKyBXGINX5NVMn3PUKRlwrnIRzJd6YhoDkmulKZo nGAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date; bh=UZ64YbX1IeQVQAPBdpjBcwK7uTLpgWnj3oDS28Ko4Qc=; b=P1Wu9dSbLRIoJvM2vr0am2IsZwa5YI2/DX9vG4c6wqFCMSVFWhN0R/YOp44rb92/30 VpPz4+sNe/K4qdhgyy16PNVpVuTtTwYkwsUgbJENcH4ooxjKmHDAFZ6HiaRfPQpg16zo E0J3JPIksGoN7hzfOjUB8krQhhw4O30DFDa0TU8lzOtwmCtG4QoCdgsIWE8l5RbLAUmy EpCNPvcW3SvzcVmLW42xtZ8t5hprF/p5dWNKRi1AGfupLrc6dH8Xa1opxfcBcnO/XydO KqJqoVjBQZIyXTY/zVYuf/FEAs/2zihTifea3EBSfMqS+AOsYCyYIiDkU0csESyrO29t P2Jw== X-Gm-Message-State: ACgBeo2Ig+Dqiw5N98G8l4Bez+mhkPAlLu24LPtpDpU9lm89zq48hp+4 x7aDZRnr5/gpNu7bPu223UmrulB7l45qiECfeq0= X-Google-Smtp-Source: AA6agR6/gt4CCfMJlSgVRr1oUXm9dNZtKS+YWiTw+UsHkZ8RfepoD8Y9lPowK7fR9Nr1J9PbKPcbkEc4n2GFIS/E0HE= X-Received: by 2002:a17:902:6b88:b0:173:c1:691b with SMTP id p8-20020a1709026b8800b0017300c1691bmr26555298plk.18.1662980109550; Mon, 12 Sep 2022 03:55:09 -0700 (PDT) MIME-Version: 1.0 References: <20220908183010.3290473-1-jwakely@redhat.com> In-Reply-To: <20220908183010.3290473-1-jwakely@redhat.com> From: =?UTF-8?Q?Daniel_Kr=C3=BCgler?= Date: Mon, 12 Sep 2022 12:55:06 +0200 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, gcc-patches@gcc.gnu.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,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: Am Do., 8. Sept. 2022 um 20:30 Uhr schrieb Jonathan Wakely via Libstdc++ : > > 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. > --- [..] > +// { dg-do compile { target c++11 } } > + > +// 3629. make_error_code and make_error_condition are customization points > +// Verify that make_error_code is looked up using ADL only. > + > +namespace user > +{ > + struct E1; > +} > + > +// N.B. not in associated namespace of E1, and declared before . > +user::E1 make_error_code(user::E1); > + > +#include // declares std::make_error_code(future_errc) > +#include > + > +namespace user > +{ > + struct E1 > + { > + operator std::error_code() const; > + }; > + > + struct E2 > + { > + operator std::future_errc() const; > + }; > + > + struct E3 > + { > + operator std::errc() const; > + }; > +} > + > +template<> struct std::is_error_code_enum : std::true_type { }; > +template<> struct std::is_error_code_enum : std::true_type { }; > +template<> struct std::is_error_code_enum : std::true_type { }; > + > +// ::make_error_code(E1) should not be found by name lookup. > +std::error_code e1( user::E1{} ); // { dg-error "here" } > + > +// std::make_error_code(errc) should not be found by name lookup. > +std::error_code e2( user::E2{} ); // { dg-error "here" } (1) Unless I'm misunderstanding something here, the comment above doesn't match here, it should mention (std::)future_errc instead. > +// std::make_error_code(future_errc) should not be found by name lookup. > +std::error_code e3( user::E3{} ); // { dg-error "here" } (2) Unless I'm misunderstanding something here, the comment above doesn't match here, it should mention (std::)errc instead. > +// { dg-error "use of deleted function" "" { target *-*-* } 0 } > diff --git a/libstdc++-v3/testsuite/19_diagnostics/error_condition/cons/lwg3629.cc b/libstdc++-v3/testsuite/19_diagnostics/error_condition/cons/lwg3629.cc > new file mode 100644 > index 00000000000..e34b53de8a1 > --- /dev/null > +++ b/libstdc++-v3/testsuite/19_diagnostics/error_condition/cons/lwg3629.cc > @@ -0,0 +1,48 @@ > +// { dg-do compile { target c++11 } } > + > +// 3629. make_error_code and make_error_condition are customization points > +// Verify that make_error_condition is looked up using ADL only. > + > +namespace user > +{ > + struct E1; > +} > + > +// N.B. not in associated namespace of E1, and declared before . > +user::E1 make_error_condition(user::E1); > + > +#include // declares std::make_error_condition(future_errc) > +#include > + > +namespace user > +{ > + struct E1 > + { > + operator std::error_code() const; > + }; > + > + struct E2 > + { > + operator std::future_errc() const; > + }; > + > + struct E3 > + { > + operator std::errc() const; > + }; > +} > + > +template<> struct std::is_error_condition_enum : std::true_type { }; > +template<> struct std::is_error_condition_enum : std::true_type { }; > +template<> struct std::is_error_condition_enum : std::true_type { }; > + > +// ::make_error_condition(E1) should not be found by name lookup. > +std::error_condition e1( user::E1{} ); // { dg-error "here" } > + > +// std::make_error_condition(errc) should not be found by name lookup. > +std::error_condition e2( user::E2{} ); // { dg-error "here" } Ditto here (1) > +// std::make_error_condition(future_errc) should not be found by name lookup. > +std::error_condition e3( user::E3{} ); // { dg-error "here" } Ditto here (2) > +// { dg-error "use of deleted function" "" { target *-*-* } 0 } > -- > 2.37.3 - Daniel