From a364488f7a70ebf6c1fd59fed9f6a8a477591087 Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Thu, 23 Jun 2022 18:42:55 +0100 Subject: [PATCH] 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. --- 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 f96552a..71d5207 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.7.4