From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2181) id A39A9386F460; Mon, 27 Jun 2022 10:16:52 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A39A9386F460 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 r13-1288] libstdc++: Make std::move_only_function never valueless in std::variant X-Act-Checkin: gcc X-Git-Author: Jonathan Wakely X-Git-Refname: refs/heads/master X-Git-Oldrev: da55353e95f8ace6ff7d48e208e4f216623f6324 X-Git-Newrev: a364488f7a70ebf6c1fd59fed9f6a8a477591087 Message-Id: <20220627101652.A39A9386F460@sourceware.org> Date: Mon, 27 Jun 2022 10:16:52 +0000 (GMT) X-BeenThere: libstdc++-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libstdc++-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Jun 2022 10:16:52 -0000 https://gcc.gnu.org/g:a364488f7a70ebf6c1fd59fed9f6a8a477591087 commit r13-1288-ga364488f7a70ebf6c1fd59fed9f6a8a477591087 Author: Jonathan Wakely Date: Thu Jun 23 18:42:55 2022 +0100 libstdc++: Make std::move_only_function never valueless in std::variant 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. Diff: --- 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