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 [216.205.24.124]) by sourceware.org (Postfix) with ESMTPS id 16234385AC0A for ; Wed, 17 Nov 2021 17:36:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 16234385AC0A Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-539-Jv_RUdosMrqnQCEnBuXCqg-1; Wed, 17 Nov 2021 12:36:55 -0500 X-MC-Unique: Jv_RUdosMrqnQCEnBuXCqg-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A76B887D552; Wed, 17 Nov 2021 17:36:54 +0000 (UTC) Received: from localhost (unknown [10.33.36.17]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4FF7518A50; Wed, 17 Nov 2021 17:36:53 +0000 (UTC) From: Jonathan Wakely To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [committed] libstdc++: Use std::construct_at in net::ip::address Date: Wed, 17 Nov 2021 17:36:53 +0000 Message-Id: <20211117173653.4179172-1-jwakely@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" X-Spam-Status: No, score=-14.1 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_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=unavailable autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Nov 2021 17:37:00 -0000 Tested powerpc64le-linux, pushed to trunk. Using placement-new isn't valid in constant expressions, so this replaces it with std::construct_at (via the std::_Construct function that is usable before C++20). libstdc++-v3/ChangeLog: * include/experimental/internet (address): Use std::_Construct to initialize union members. --- libstdc++-v3/include/experimental/internet | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libstdc++-v3/include/experimental/internet b/libstdc++-v3/include/experimental/internet index 95b8cdc9963..5e2ef00c16f 100644 --- a/libstdc++-v3/include/experimental/internet +++ b/libstdc++-v3/include/experimental/internet @@ -466,9 +466,9 @@ namespace ip address(const address& __a) noexcept : _M_uninit(), _M_is_v4(__a._M_is_v4) { if (_M_is_v4) - ::new (std::addressof(_M_v4)) address_v4(__a.to_v4()); + std::_Construct(std::addressof(_M_v4), __a.to_v4()); else - ::new (std::addressof(_M_v6)) address_v6(__a.to_v6()); + std::_Construct(std::addressof(_M_v6), __a.to_v6()); } constexpr @@ -491,7 +491,7 @@ namespace ip address& operator=(const address_v4& __a) noexcept { - ::new (std::addressof(_M_v4)) address_v4(__a); + std::_Construct(std::addressof(_M_v4), __a); _M_is_v4 = true; return *this; } @@ -499,7 +499,7 @@ namespace ip address& operator=(const address_v6& __a) noexcept { - ::new (std::addressof(_M_v6)) address_v6(__a); + std::_Construct(std::addressof(_M_v6), __a); _M_is_v4 = false; return *this; } -- 2.31.1