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 29A8D385C301 for ; Fri, 31 Mar 2023 14:49:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 29A8D385C301 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=1680274196; 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=xEmngDYSNEunFoZAeH+rqv/7qdZCS3I7TOm63lGv5WM=; b=NigOZACo+6+GHK0ognd94u+1LmzL7JFyZK4BifNNI11OVidwTnX1ET8ZfGT+qDzevg2g7O jD86wlbEEJB91WdNcWWzi7BZYN/nd22TbAusZCi6LJpK7CCUh0yNhqlDmpHVxEkJUBirDv y5yZYYCb2uNSoikb1gj+3oQK53GFRxU= Received: from mail-lf1-f71.google.com (mail-lf1-f71.google.com [209.85.167.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-13-JiEH6DI_MaWDe9iIljwgYw-1; Fri, 31 Mar 2023 10:49:55 -0400 X-MC-Unique: JiEH6DI_MaWDe9iIljwgYw-1 Received: by mail-lf1-f71.google.com with SMTP id e12-20020a19674c000000b004e9af173e04so8808432lfj.14 for ; Fri, 31 Mar 2023 07:49:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680274193; 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=xEmngDYSNEunFoZAeH+rqv/7qdZCS3I7TOm63lGv5WM=; b=b9tueBsJMs6zYjNisSNI/dfbl8zIC39Bqaibzz2MDviaByr5C98GpLuYG0AWEqHRBh xjX/19QXyJFrtPEQfGEArAkwCXU2zW14SmqyZbOqnRmV7qLZsfJomPW0A+Q/gkcNJ6+p ic9vBDB7Z7+CP/YzjHBx09JhF8hgow3GSThoQeQ6iqAyCzECztI4/MlB1Yc1c/gTi72a +rzIBGOb3HwuLAFgULOLqB5NduzqBkJWhkxtLyo5uMp8uGBAahKDsokZls8eeSsKhcpt ZYvHUb5lgRdGjt3RCgIocBk7/1QzuLjs4Sjfyoha9ff9grFco4nn8u7yut2VWV/7po01 P0pA== X-Gm-Message-State: AAQBX9doQOErJp8lpdTjhLEuFkErYJj5c3p+AENuIvvsb81/22eOObYF JPbLCAHSBHtn1jsku4APjm8dOIYLYUKOkYQ9vLLR5usOGfMQTT1Q1wkkIbGwMdgPyomFQLeB+29 6m3gxiSsFiy05onNxbMgl2TZvR728+E4= X-Received: by 2002:a2e:8346:0:b0:29a:7cf0:3535 with SMTP id l6-20020a2e8346000000b0029a7cf03535mr3302555ljh.4.1680274193829; Fri, 31 Mar 2023 07:49:53 -0700 (PDT) X-Google-Smtp-Source: AKy350ZhdU8iLdQStivSDyMcokaBlYbzRF0jDR6/Bi80j9TOIqOhqb2zWPca04zyNdJKSJi4lBvCojYfDGvA68q2VZ8= X-Received: by 2002:a2e:8346:0:b0:29a:7cf0:3535 with SMTP id l6-20020a2e8346000000b0029a7cf03535mr3302546ljh.4.1680274193541; Fri, 31 Mar 2023 07:49:53 -0700 (PDT) MIME-Version: 1.0 References: <20230329234000.1405216-1-jwakely@redhat.com> In-Reply-To: From: Jonathan Wakely Date: Fri, 31 Mar 2023 15:49:42 +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=unavailable 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 Fri, 31 Mar 2023 at 12:06, Jonathan Wakely wrote: > > 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 o= f > > > the union members. And then later, once we have something like P2641, > > > we can re-add the constexpr keywords and use is_within_lifetime durin= g > > > constant evaluation. That way we don't add a bool then need to take i= t > > > 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 ac= tive. > + // 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; > + } Done in commit 10e573e86c6a1ed11df529288ed8fba97f876032