public inbox for libstdc++-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-10255] libstdc++: Explicitly default some copy ctors and assignments Date: Mon, 18 Mar 2024 14:06:21 +0000 (GMT) [thread overview] Message-ID: <20240318140621.6CF6A385840C@sourceware.org> (raw) https://gcc.gnu.org/g:a389921f175c30e8ca0da38ccb79ed60cf744fd4 commit r12-10255-ga389921f175c30e8ca0da38ccb79ed60cf744fd4 Author: Jonathan Wakely <jwakely@redhat.com> Date: Tue Aug 8 16:24:31 2023 +0100 libstdc++: Explicitly default some copy ctors and assignments The standard says that the implicit copy assignment operator is deprecated for classes that have a user-provided copy constructor, and vice versa. libstdc++-v3/ChangeLog: * include/bits/new_allocator.h (__new_allocator): Define copy assignment operator as defaulted. * include/std/complex (complex<float>, complex<double>) (complex<long double>): Define copy constructor as defaulted. (cherry picked from commit 008e439f34d4b356825a6c9b70245143f00bd353) Diff: --- libstdc++-v3/include/bits/new_allocator.h | 4 ++++ libstdc++-v3/include/std/complex | 12 ++++++++++++ 2 files changed, 16 insertions(+) diff --git a/libstdc++-v3/include/bits/new_allocator.h b/libstdc++-v3/include/bits/new_allocator.h index 99f7a2ee51e..d066d015a9d 100644 --- a/libstdc++-v3/include/bits/new_allocator.h +++ b/libstdc++-v3/include/bits/new_allocator.h @@ -86,6 +86,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _GLIBCXX20_CONSTEXPR __new_allocator(const __new_allocator<_Tp1>&) _GLIBCXX_USE_NOEXCEPT { } +#if __cplusplus >= 201103L + __new_allocator& operator=(const __new_allocator&) = default; +#endif + #if __cplusplus <= 201703L ~__new_allocator() _GLIBCXX_USE_NOEXCEPT { } diff --git a/libstdc++-v3/include/std/complex b/libstdc++-v3/include/std/complex index 8f9368fd7d0..bdc238e73b0 100644 --- a/libstdc++-v3/include/std/complex +++ b/libstdc++-v3/include/std/complex @@ -1098,6 +1098,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } #endif +#if __cplusplus >= 201103L + _GLIBCXX14_CONSTEXPR complex(const complex&) = default; +#endif + explicit _GLIBCXX_CONSTEXPR complex(const complex<double>&); explicit _GLIBCXX_CONSTEXPR complex(const complex<long double>&); @@ -1244,6 +1248,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } #endif +#if __cplusplus >= 201103L + _GLIBCXX14_CONSTEXPR complex(const complex&) = default; +#endif + _GLIBCXX_CONSTEXPR complex(const complex<float>& __z) : _M_value(__z.__rep()) { } @@ -1391,6 +1399,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } #endif +#if __cplusplus >= 201103L + _GLIBCXX14_CONSTEXPR complex(const complex&) = default; +#endif + _GLIBCXX_CONSTEXPR complex(const complex<float>& __z) : _M_value(__z.__rep()) { }
reply other threads:[~2024-03-18 14:06 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=20240318140621.6CF6A385840C@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).