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.129.124]) by sourceware.org (Postfix) with ESMTPS id 4380D3858D33 for ; Fri, 31 Mar 2023 11:06:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 4380D3858D33 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=1680260792; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Nq5weSEJ8vc4tZccP2QyHUlI0KNYN7WV08EFcvEdp2E=; b=Gxz+b1ZDnaBsUSAzCtuUxk7XzkGOOrEsAlSGMNhjmqUKeCC983EDhqzHFmW/GPD5Y7mTS9 drOv1n+sK89rXYTxmxrY7TvtwHD2GxwAuXlVAv9FKMPGOUuY11QE44fj7wR6gu8PhZKhjd IBk/gOJgLEX7IJTQNM8w7IPKFVv55KQ= Received: from mail-lf1-f70.google.com (mail-lf1-f70.google.com [209.85.167.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-621-ksgHoQNsOfe8Q_EeaCuyDQ-1; Fri, 31 Mar 2023 07:06:31 -0400 X-MC-Unique: ksgHoQNsOfe8Q_EeaCuyDQ-1 Received: by mail-lf1-f70.google.com with SMTP id e12-20020ac24e0c000000b004e84231dde1so8674993lfr.15 for ; Fri, 31 Mar 2023 04:06:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680260790; h=content-transfer-encoding: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=Nq5weSEJ8vc4tZccP2QyHUlI0KNYN7WV08EFcvEdp2E=; b=JSPGVgsblvoYlUtFrq8htF6bOLeKApPFZ9hGL9/So2EVgKXWWmCHQZILQtxhom+3uZ Q5dPVrZrXllHI1ruRNyp+rqTBLWgnrpt4LT25O5EfRi04qQ/iFGLZdyR+/GUauK5mZXa jBgTcXocRmKqZxAQFjWOjGDDr8MqLqPCeBak+XG2cwWoAACIwCSSb0UpwlhUZe0z50ba 9w8NkQyF5bfdyR6TX2o+nAx5Hha2WXso7aujbe1vmyIPQeFa1uXB5XjLqgiE+Vlvx+xU 0caA4T144RJtBfnM3MIH1aXEimQlR4e/fjY9ZYadxQ/4GgYPvU9rNpwLXk6opShQayHg CY6Q== X-Gm-Message-State: AAQBX9euhanBwPp2ZZ52WSdn8HCqMdHQseA9PnBt8n2hYrWwQBGax492 +G3++p2tNsL40PvjO5EyKusGSYNXQjiW4eQqzBfFEAszV+ANGSibDTIPoHTPuA30Eqm5VGAxr7a upg8YJxYl0GDaiIaJzM9yaSUhi2nmpHE= X-Received: by 2002:a2e:b60d:0:b0:299:ac4e:a8a6 with SMTP id r13-20020a2eb60d000000b00299ac4ea8a6mr8313880ljn.9.1680260790172; Fri, 31 Mar 2023 04:06:30 -0700 (PDT) X-Google-Smtp-Source: AKy350Z8N7hyn73Za3jKo7QA/B/J/eUDt80OlnRo7RKzpYZQDnxMDdvBcunsOJaSgRs4Fzn9tgQtEyxLeg/zSBdov/0= X-Received: by 2002:a2e:b60d:0:b0:299:ac4e:a8a6 with SMTP id r13-20020a2eb60d000000b00299ac4ea8a6mr8313873ljn.9.1680260789896; Fri, 31 Mar 2023 04:06:29 -0700 (PDT) MIME-Version: 1.0 References: <20230329234000.1405216-1-jwakely@redhat.com> In-Reply-To: From: Jonathan Wakely Date: Fri, 31 Mar 2023 12:06:18 +0100 Message-ID: Subject: Re: [committed] libstdc++: Fix constexpr functions in To: =?UTF-8?Q?Daniel_Kr=C3=BCgler?= Cc: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org 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.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,TXREP 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: On Thu, 30 Mar 2023 at 17:01, Daniel Kr=C3=BCgler wrote: > > Am Do., 30. M=C3=A4rz 2023 um 18:00 Uhr schrieb Jonathan Wakely via > Libstdc++ : > > > [..] > > > > In fact, thinking about P2641 some more, I might revert this change. > > Instead of adding an extra bool member to support constexpr, I think > > I'll just remove the 'constexpr' keywords from basic_endpoint for now, > > and implement it in terms of just inspecting the sa_family_t member of > > the union members. And then later, once we have something like P2641, > > we can re-add the constexpr keywords and use is_within_lifetime during > > constant evaluation. That way we don't add a bool then need to take it > > away again, changing the ABI each time. > > I was just going to make the same suggestion. Actually, as pointed out in Barry's P2641R1 paper, we can just use GCC's __builtin_constant_p: + constexpr bool + _M_is_v6() const noexcept + { + // For constexpr eval we can just detect which union member is acti= ve. + // i.e. emulate P2641R1's std::is_active_member(&_M_data._M_v6)). + if (std::__is_constant_evaluated()) + return __builtin_constant_p(_M_data._M_v6.sin6_family); + return _M_data._M_v6.sin6_family =3D=3D AF_INET6; + }