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 [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 554863857BAF for ; Mon, 13 Jun 2022 19:27:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 554863857BAF Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-610-jNIIcvVROUSRr8_7pXpi5Q-1; Mon, 13 Jun 2022 15:27:56 -0400 X-MC-Unique: jNIIcvVROUSRr8_7pXpi5Q-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E27B03806736; Mon, 13 Jun 2022 19:27:55 +0000 (UTC) Received: from localhost (unknown [10.33.36.159]) by smtp.corp.redhat.com (Postfix) with ESMTP id A8D5518EA3; Mon, 13 Jun 2022 19:27:55 +0000 (UTC) From: Jonathan Wakely To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [committed] libstdc++: Use type_identity_t for non-deducible std::atomic_xxx args Date: Mon, 13 Jun 2022 20:27:55 +0100 Message-Id: <20220613192755.928442-1-jwakely@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-13.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_NONE, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE 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: libstdc++@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libstdc++ mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Jun 2022 19:27:59 -0000 Tested powerpc64le-linux, pushed to trunk. -- >8 -- This is LWG 3220 which is about to become Tentatively Ready. libstdc++-v3/ChangeLog: * include/std/atomic (__atomic_val_t): Use __type_identity_t instead of atomic::value_type, as per LWG 3220. * testsuite/29_atomics/atomic/lwg3220.cc: New test. --- libstdc++-v3/include/std/atomic | 4 +++- libstdc++-v3/testsuite/29_atomics/atomic/lwg3220.cc | 13 +++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 libstdc++-v3/testsuite/29_atomics/atomic/lwg3220.cc diff --git a/libstdc++-v3/include/std/atomic b/libstdc++-v3/include/std/atomic index 1c6acfa36d0..70055b8fa83 100644 --- a/libstdc++-v3/include/std/atomic +++ b/libstdc++-v3/include/std/atomic @@ -1244,8 +1244,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { atomic_flag_clear_explicit(__a, memory_order_seq_cst); } /// @cond undocumented + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 3220. P0558 broke conforming C++14 uses of atomic shared_ptr template - using __atomic_val_t = typename atomic<_Tp>::value_type; + using __atomic_val_t = __type_identity_t<_Tp>; template using __atomic_diff_t = typename atomic<_Tp>::difference_type; /// @endcond diff --git a/libstdc++-v3/testsuite/29_atomics/atomic/lwg3220.cc b/libstdc++-v3/testsuite/29_atomics/atomic/lwg3220.cc new file mode 100644 index 00000000000..d2ff6cf9fe3 --- /dev/null +++ b/libstdc++-v3/testsuite/29_atomics/atomic/lwg3220.cc @@ -0,0 +1,13 @@ +// { dg-do compile { target c++11 } } +// DR 3220. P0558 broke conforming C++14 uses of atomic shared_ptr + +#include +#include + +struct Abstract { virtual void test() = 0; }; +struct Concrete : Abstract { virtual void test() override {} }; + +int main() { + std::shared_ptr ptr; + std::atomic_store(&ptr, std::make_shared()); +} -- 2.34.3