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 7E487386C58D for ; Mon, 27 Jun 2022 10:17:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 7E487386C58D 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-618-7AV4rnB6P76Pr9jWhhJwZQ-1; Mon, 27 Jun 2022 06:17:22 -0400 X-MC-Unique: 7AV4rnB6P76Pr9jWhhJwZQ-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 90F59811E80; Mon, 27 Jun 2022 10:17:22 +0000 (UTC) Received: from localhost (unknown [10.33.36.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id 56A8640C1289; Mon, 27 Jun 2022 10:17:22 +0000 (UTC) From: Jonathan Wakely To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [committed] libstdc++: Make std::move_only_function never valueless in std::variant Date: Mon, 27 Jun 2022 11:17:21 +0100 Message-Id: <20220627101721.33917-1-jwakely@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-12.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=ham 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, 27 Jun 2022 10:17:25 -0000 Tested powerpc64le-linux, pushed to trunk. -- >8 -- This is not suitable to backport, as it affects the ABI of std::variant and so isn't appropriate for a release branch. libstdc++-v3/ChangeLog: * include/bits/move_only_function.h (_Never_valueless_alt): Define partial specialization for std::move_only_function. --- libstdc++-v3/include/bits/move_only_function.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/libstdc++-v3/include/bits/move_only_function.h b/libstdc++-v3/include/bits/move_only_function.h index f96552a7c89..71d52074978 100644 --- a/libstdc++-v3/include/bits/move_only_function.h +++ b/libstdc++-v3/include/bits/move_only_function.h @@ -183,6 +183,18 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION constexpr bool __is_move_only_function_v> = true; /// @endcond + namespace __detail::__variant + { + template struct _Never_valueless_alt; // see + + // Provide the strong exception-safety guarantee when emplacing a + // move_only_function into a variant. + template + struct _Never_valueless_alt> + : true_type + { }; + } // namespace __detail::__variant + _GLIBCXX_END_NAMESPACE_VERSION } // namespace std -- 2.36.1