From patchwork Wed Aug 9 14:21:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 133280 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c44e:0:b0:3f2:4152:657d with SMTP id w14csp2836194vqr; Wed, 9 Aug 2023 07:25:59 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHiOySklbbF3Vwloa85tIpRvdjKMhUeiR9HFpsMd7Ru3nZOioMQSsZDL+9GkzoBj1WrTKWJ X-Received: by 2002:a17:906:8a77:b0:99b:f03d:de37 with SMTP id hy23-20020a1709068a7700b0099bf03dde37mr2134633ejc.60.1691591158851; Wed, 09 Aug 2023 07:25:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691591158; cv=none; d=google.com; s=arc-20160816; b=FS0GPpweiufe4FssnNe69cSVuvDae0tILcD1Hysyv3FSF6oWKlA+uONwN46I3lPMyI TxGOEYIKStDjHPFrdmbKyjPGAFicr7+Z6NxzECS+YgpXUwmO/a5iJD/ht3SJD5fdsu5d jYxK24UZ/lxkErzjctEH2j8KPX2KO78f+jteQ75hqvSNK5BcjJhN72MDAv+Ce7ACcy74 nEAbbHry98umTHwj7yMtyMLrDIrciEp6Kg0coVQSYzKXDxoADOcV1J1AlRZ8gcJf9qgD YzHpGgyFGKDwk/7eAf9SVD81Eoh7txENo5tzNu2JVzVjRS9vXAVUFtAnhTGf8GJ8ZFDj GuQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:message-id:date:subject:to :dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=YPpFIzNrJJyf5iC2YFBx1dxoYrtuby5TSmyX8PibtgM=; fh=sC8lnOfyH6gL5FYlMbZ1VDz6qVPMj/3ViLJWKNUCUgQ=; b=bEScNHHMxa8v0hBHMNF3e/Sgr/Hh0WYrg5jSMfwaXIWt7/f/TthfCF4NEHXTGJdXnp kSddlqNxBOltSxNUxvosdVrbKTYjjYHe1EZVuCU4OdAdVvnx+TKObTKMQPq4TRj1P0pG Uy4LoAdxAQFg190L3M6/U1ikCvnzf+tVehSiEnWm6ecyKf2kqy3rJJ2dpEVgudm1Bxdz Ptj8/cMoGMXnAQh9tiXm85+6jypAP6gAY6+yFMkAqvyVGW7CwG9f4LGj++9tTJOJ4DKg 3Snpzv+VnSp3Sx8rsh4WifduTkAtm9wyBqoERjdJ5zUTuS5+ef0x6gvyTfVsgks8N+qx gfsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=O+B1cU9A; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id p18-20020a1709066a9200b0099bcee97a5dsi8068583ejr.761.2023.08.09.07.25.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Aug 2023 07:25:58 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=O+B1cU9A; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id CDD67388302B for ; Wed, 9 Aug 2023 14:23:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CDD67388302B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1691591015; bh=YPpFIzNrJJyf5iC2YFBx1dxoYrtuby5TSmyX8PibtgM=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=O+B1cU9A7KVaWLRl5kBlcHoIIiGuGlvvdkNt65sCRcD2UIsCru7f7J63pKNr4zIab XbeTXZTrLaoiLvbM/IfDBqfs35QmYO93dAwrkHTLKEsHJ5gZHFHxUGdr+mPor8YEpn P0uqziIf1vdScRCNg3QFhfxCczIkbDNF6+LKju5A= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org 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 5FEF13856DE2 for ; Wed, 9 Aug 2023 14:22:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5FEF13856DE2 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-103-x3XaROhwNj-IYg4bjJ8bKg-1; Wed, 09 Aug 2023 10:21:57 -0400 X-MC-Unique: x3XaROhwNj-IYg4bjJ8bKg-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3894A101A52E; Wed, 9 Aug 2023 14:21:57 +0000 (UTC) Received: from localhost (unknown [10.42.28.187]) by smtp.corp.redhat.com (Postfix) with ESMTP id F01042026D4B; Wed, 9 Aug 2023 14:21:56 +0000 (UTC) To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [committed] libstdc++: Explicitly default some copy ctors and assignments Date: Wed, 9 Aug 2023 15:21:47 +0100 Message-ID: <20230809142156.1014897-1-jwakely@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-11.8 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_NONE, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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-Patchwork-Original-From: Jonathan Wakely via Gcc-patches From: Jonathan Wakely Reply-To: Jonathan Wakely Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773761891392747314 X-GMAIL-MSGID: 1773761891392747314 Tested x86_64-linux. Pushed to trunk. -- >8 -- 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. --- 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 0a0b12eb504..357700292ed 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 f01a3af4371..0ba2167bf02 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