aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2022-06-23 18:42:55 +0100
committerJonathan Wakely <jwakely@redhat.com>2022-06-27 11:08:16 +0100
commita364488f7a70ebf6c1fd59fed9f6a8a477591087 (patch)
tree9cbdf43341815173039bcf56a7b41dbe53cf2742
parentda55353e95f8ace6ff7d48e208e4f216623f6324 (diff)
downloadgcc-a364488f7a70ebf6c1fd59fed9f6a8a477591087.zip
gcc-a364488f7a70ebf6c1fd59fed9f6a8a477591087.tar.gz
gcc-a364488f7a70ebf6c1fd59fed9f6a8a477591087.tar.bz2
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.
-rw-r--r--libstdc++-v3/include/bits/move_only_function.h12
1 files changed, 12 insertions, 0 deletions
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<move_only_function<_Tp>> = true;
/// @endcond
+ namespace __detail::__variant
+ {
+ template<typename> struct _Never_valueless_alt; // see <variant>
+
+ // Provide the strong exception-safety guarantee when emplacing a
+ // move_only_function into a variant.
+ template<typename... _Signature>
+ struct _Never_valueless_alt<std::move_only_function<_Signature...>>
+ : true_type
+ { };
+ } // namespace __detail::__variant
+
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std