Make variant's index part of the hash value git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@288554 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/variant b/include/variant index 1207b59..45efc78 100644 --- a/include/variant +++ b/include/variant
@@ -1526,7 +1526,8 @@ inline _LIBCPP_INLINE_VISIBILITY result_type operator()(const argument_type& __v) const { using __variant_detail::__visitation::__variant; - return __v.valueless_by_exception() + size_t __res = + __v.valueless_by_exception() ? __v.index() : __variant::__visit_alt( [](const auto& __alt) { @@ -1535,6 +1536,7 @@ return hash<__value_type>{}(__alt.__value); }, __v); + return __hash_combine(__res, hash<size_t>{}(__v.index())); } };