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 567233858CDB for ; Fri, 31 Mar 2023 11:06:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 567233858CDB 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=1680260793; 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=hXy5JygDJZufZl7MU8FmtXppd59jTTtM+JWaZ3QJkUtfrskQBs8VCTw6I9lqXBDCrRMgUT zFjksBYHUSfCPvIhCbrNvHmCB1wOaOxs540Nvb88KiA6HC4z4w08vgobtY5WVJ+bin2Ymk wqvLfgjIft6n1xmYNT3h8nu1KJ3dR/U= 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-125-qG-dLQhQPPSBXCuYACfcZg-1; Fri, 31 Mar 2023 07:06:31 -0400 X-MC-Unique: qG-dLQhQPPSBXCuYACfcZg-1 Received: by mail-lf1-f70.google.com with SMTP id g33-20020a0565123ba100b004dc6259b7acso8548397lfv.6 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=q3zytIZaujt3XQv6yNyHDNvpbA74hcANrnjoomWEduy/EUedxmUTYzx2/1ax/9i248 vxoUyQtoHnvsTdESexqLVgP5GuaCpngD1znPM87UyCkNgjMD+vlwtMQUTAw1GUQjyGlh oCsnUNjMUwe39XCN8Jr8JIT81LMTyt+qvZpcYc7YiwFwwv0PvMGK3BpoWT4hLp1qj26S CnZHQSckQ+YEnbhYaDB0PI4C19lzyNF8Z+2GbZ/7tR3UTzuIcN/l8h3egTXFYQBMc1Jg WlZCb+fDUAOsEwDyhNKcdCJ2NyZTeaObyYj105xZuD2TfGM295mSMLPV+knjhs3E6Vv/ sz3Q== X-Gm-Message-State: AAQBX9eBF62eiz4h37CGakQNBMokJqhZLTLZQUOa8VREX1erMh+iV3IQ HH4fOGSQLvJuGpnwAH5UJ0rAJcr0nLLe53WuAFMQFYoypV3Xzr+EAT/QJVMwSyBKibsJQV/2k+W dhDlBbl5aYvdMbesi8UXTWAW9Glz/Oo+uhw== X-Received: by 2002:a2e:b60d:0:b0:299:ac4e:a8a6 with SMTP id r13-20020a2eb60d000000b00299ac4ea8a6mr8313881ljn.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; + }