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 0BB293858C2C for ; Fri, 18 Mar 2022 15:49:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 0BB293858C2C Received: from mail-yw1-f199.google.com (mail-yw1-f199.google.com [209.85.128.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-638-b2Bgw4UiNzmta0zoCJdQyA-1; Fri, 18 Mar 2022 11:49:05 -0400 X-MC-Unique: b2Bgw4UiNzmta0zoCJdQyA-1 Received: by mail-yw1-f199.google.com with SMTP id 00721157ae682-2d07ae11462so74170277b3.8 for ; Fri, 18 Mar 2022 08:49:05 -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; bh=c96U9lqxGrfemFk1sIcknuPjmNcvjH22YSWDoPe0HrE=; b=8GSh5COeRlKJmAXTpW202vY4kk1AzSmCj4QG5IVn18kopRdaiqFzaI1Fx4qNrc7SDF d+VJVTkj21B1s55sToLaXH0pbO9x0m3dlHhKFVFNDOdOZkVr9NPnLeVZL/fg4e+a13PW TvvVSRCbGAj6viY+alalIHLRXyaKVuxQyWld06t6uJM9NJobqTirOIsb4c7uJ9uqaYzI /siwss6Q1Dx6ZrXU/oJxKsA610Fr0T2+Ro32TLhjbZnOX346lZLo2tlrEeFcoth7gb9s I921sNISoI63JIw2EDSPybv0uR+tM0dlgra+ECvp3W6jxtJZEbcWBxyPPuYhBpAcxs+O DvTg== X-Gm-Message-State: AOAM532GpKdt2NRS/ME8J4Lno58N14p8kmjlYCpEmiTDe2V2DFF+bBBW rdcaKiIwtVbac3GXlNwHwyO/OqTHnpSRKaS44ZJylcvXo9svVhgJl+ayzEhmSpnBLL0UpcHtLVW 4lNNpdgVD1cmqsroSIXq2hhv4z9LzJcw= X-Received: by 2002:a81:7c88:0:b0:2e5:8fa2:29d with SMTP id x130-20020a817c88000000b002e58fa2029dmr11950335ywc.346.1647618544990; Fri, 18 Mar 2022 08:49:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzMjHm5L9bsoMHzSsoe/RSTGLHRhtQAWAmIlSfkOR+ujjnXmwSuBSVy/rAzrxC7fr9vPwAt6yGiQh5sozD/PeI= X-Received: by 2002:a81:7c88:0:b0:2e5:8fa2:29d with SMTP id x130-20020a817c88000000b002e58fa2029dmr11950313ywc.346.1647618544740; Fri, 18 Mar 2022 08:49:04 -0700 (PDT) MIME-Version: 1.0 References: <20220318154303.532138-1-jwakely@redhat.com> In-Reply-To: <20220318154303.532138-1-jwakely@redhat.com> From: Jonathan Wakely Date: Fri, 18 Mar 2022 15:48:53 +0000 Message-ID: Subject: Re: [committed] libstdc++: Simplify constraints for std::any construction [PR104242] To: Jonathan Wakely Cc: "libstdc++" , gcc Patches X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-14.7 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_H5, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE, URI_HEX autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: Fri, 18 Mar 2022 15:49:08 -0000 Oops, I meant to change the commit summary line to Un-simplify, since it was reverting the "Simplify constaints ..." commit. On Fri, 18 Mar 2022 at 15:43, Jonathan Wakely via Libstdc++ wrote: > > Tested powerpc64le-linux, pushed to trunk, > > -- >8 -- > > Partially revert r12-4190-g6da36b7d0e43b6f9281c65c19a025d4888a25b2d > because using __and_<..., is_copy_constructible> when T is incomplete > results in an error about deriving from is_copy_constructible when > that is incomplete. I don't know how to fix that, so this simply > restores the previous constraint which worked in this case (even though > I think it's technically undefined to use is_copy_constructible with > incomplete T). This doesn't restore exactly what we had before, but uses > the is_copy_constructible_v and __is_in_place_type_v variable templates > instead of the ::value member. > > libstdc++-v3/ChangeLog: > > PR libstdc++/104242 > * include/std/any (any(T&&)): Revert change to constraints. > * testsuite/20_util/any/cons/104242.cc: New test. > --- > libstdc++-v3/include/std/any | 4 ++-- > libstdc++-v3/testsuite/20_util/any/cons/104242.cc | 12 ++++++++++++ > 2 files changed, 14 insertions(+), 2 deletions(-) > create mode 100644 libstdc++-v3/testsuite/20_util/any/cons/104242.cc > > diff --git a/libstdc++-v3/include/std/any b/libstdc++-v3/include/std/any > index bdad76239b4..a6770e8f235 100644 > --- a/libstdc++-v3/include/std/any > +++ b/libstdc++-v3/include/std/any > @@ -185,8 +185,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION > /// Construct with a copy of @p __value as the contained object. > template , > typename _Mgr = _Manager<_VTp>, > - typename = _Require<__not_<__is_in_place_type<_VTp>>, > - is_copy_constructible<_VTp>>> > + enable_if_t > + && !__is_in_place_type_v<_VTp>, bool> = true> > any(_Tp&& __value) > : _M_manager(&_Mgr::_S_manage) > { > diff --git a/libstdc++-v3/testsuite/20_util/any/cons/104242.cc b/libstdc++-v3/testsuite/20_util/any/cons/104242.cc > new file mode 100644 > index 00000000000..8d5868b7ff9 > --- /dev/null > +++ b/libstdc++-v3/testsuite/20_util/any/cons/104242.cc > @@ -0,0 +1,12 @@ > +// { dg-do compile { target c++17 } } > + > +// PR libstdc++/104242 - Class with constructor from std::any is not copyable > + > +#include > +#include > + > +struct A { > + A(const A&) = default; > + explicit A(std::any value); > +}; > +static_assert(std::is_copy_constructible_v); > -- > 2.34.1 >