public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Jonathan Wakely <redi@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc r12-5345] libstdc++: Use std::construct_at in net::ip::address Date: Wed, 17 Nov 2021 17:30:06 +0000 (GMT) [thread overview] Message-ID: <20211117173006.C930E3858017@sourceware.org> (raw) https://gcc.gnu.org/g:5ea8803e65eb546f58d3dccf5aff94a1638ba8b2 commit r12-5345-g5ea8803e65eb546f58d3dccf5aff94a1638ba8b2 Author: Jonathan Wakely <jwakely@redhat.com> Date: Wed Nov 17 15:05:43 2021 +0000 libstdc++: Use std::construct_at in net::ip::address 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. Diff: --- 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; }
reply other threads:[~2021-11-17 17:30 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20211117173006.C930E3858017@sourceware.org \ --to=redi@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ --cc=libstdc++-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).