From: Jonathan Wakely Date: Thu, 23 Jun 2022 17:42:55 +0000 (+0100) Subject: libstdc++: Make std::move_only_function never valueless in std::variant X-Git-Tag: basepoints/gcc-14~5919 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a364488f7a70ebf6c1fd59fed9f6a8a477591087;p=thirdparty%2Fgcc.git 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 --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