From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2181) id 4E5B13858004; Wed, 9 Aug 2023 14:21:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4E5B13858004 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1691590887; bh=xMf5BSs3KERfu3VwhxRY0ZrpMww6XyG6iIeBozoH/qI=; h=From:To:Subject:Date:From; b=mTr7XyYQAOUTGJk3GBq2NtJFaa0SWpMvsmjMgv0MiMAm/RJYclUXpGGBLTdjebRpn oiDGnn3N1/NuQL9tOHjqah0n3gk+vXEDXhwBfQuI7OnXENU9glZxI3IwoxJi/Kttdy aXI2N/5zcFaKWCAHWxvqpM5wGZQatoRbofp7wF6g= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Jonathan Wakely To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc r14-3101] libstdc++: Explicitly default some copy ctors and assignments X-Act-Checkin: gcc X-Git-Author: Jonathan Wakely X-Git-Refname: refs/heads/master X-Git-Oldrev: b9e5a4b4f035ba85b1a4065b751c2d583206b4e3 X-Git-Newrev: 008e439f34d4b356825a6c9b70245143f00bd353 Message-Id: <20230809142127.4E5B13858004@sourceware.org> Date: Wed, 9 Aug 2023 14:21:27 +0000 (GMT) List-Id: https://gcc.gnu.org/g:008e439f34d4b356825a6c9b70245143f00bd353 commit r14-3101-g008e439f34d4b356825a6c9b70245143f00bd353 Author: Jonathan Wakely 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, complex) (complex): Define copy constructor as defaulted. Diff: --- libstdc++-v3/include/bits/new_allocator.h | 4 ++++ libstdc++-v3/include/std/complex | 13 +++++++++++++ 2 files changed, 17 insertions(+) diff --git a/libstdc++-v3/include/bits/new_allocator.h b/libstdc++-v3/include/bits/new_allocator.h index 0a0b12eb5041..357700292edc 100644 --- a/libstdc++-v3/include/bits/new_allocator.h +++ b/libstdc++-v3/include/bits/new_allocator.h @@ -96,6 +96,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 f01a3af43718..0ba2167bf022 100644 --- a/libstdc++-v3/include/std/complex +++ b/libstdc++-v3/include/std/complex @@ -1359,6 +1359,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } #endif +#if __cplusplus >= 201103L + _GLIBCXX14_CONSTEXPR complex(const complex&) = default; +#endif + #if __cplusplus > 202002L template explicit(!requires(_Up __u) { value_type{__u}; }) @@ -1512,6 +1516,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } #endif +#if __cplusplus >= 201103L + _GLIBCXX14_CONSTEXPR complex(const complex&) = default; +#endif + #if __cplusplus > 202002L template explicit(!requires(_Up __u) { value_type{__u}; }) @@ -1666,6 +1674,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } #endif +#if __cplusplus >= 201103L + _GLIBCXX14_CONSTEXPR complex(const complex&) = default; +#endif + #if __cplusplus > 202002L template explicit(!requires(_Up __u) { value_type{__u}; }) @@ -1901,6 +1913,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION // Let the compiler synthesize the copy and assignment // operator. It always does a pretty good job. + constexpr complex(const complex&) = default; constexpr complex& operator=(const complex&) = default; template