-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[libc++] Fix set::operator= when instantiating with a std::pair #140385
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@llvm/pr-subscribers-libcxx Author: Nikolas Klauser (philnik777) ChangesThis has been introduced by #134819, most likely due to a merge conflict I didn't resolve properly (I thought I did in that patch what I'm now doing here). Full diff: https://github.com/llvm/llvm-project/pull/140385.diff 2 Files Affected:
diff --git a/libcxx/include/__tree b/libcxx/include/__tree
index 1903533898481..403cfe1ba4036 100644
--- a/libcxx/include/__tree
+++ b/libcxx/include/__tree
@@ -1281,7 +1281,7 @@ private:
}
_LIBCPP_HIDE_FROM_ABI void __move_assign_alloc(__tree&, false_type) _NOEXCEPT {}
- template <class _From, __enable_if_t<__is_pair_v<__remove_cvref_t<_From> >, int> = 0>
+ template <class _From, class _ValueT = _Tp, __enable_if_t<__is_tree_value_type<_ValueT>::value, int> = 0>
_LIBCPP_HIDE_FROM_ABI static void __assign_value(__get_node_value_type_t<value_type>& __lhs, _From&& __rhs) {
using __key_type = typename _NodeTypes::key_type;
@@ -1291,7 +1291,7 @@ private:
__lhs.second = std::forward<_From>(__rhs).second;
}
- template <class _To, class _From, class _ValueT = _Tp, __enable_if_t<!__is_pair_v<__remove_cvref_t<_From> >, int> = 0>
+ template <class _To, class _From, class _ValueT = _Tp, __enable_if_t<!__is_tree_value_type<_ValueT>::value, int> = 0>
_LIBCPP_HIDE_FROM_ABI static void __assign_value(_To& __lhs, _From&& __rhs) {
__lhs = std::forward<_From>(__rhs);
}
diff --git a/libcxx/test/std/containers/associative/set/set.cons/copy_assign.pass.cpp b/libcxx/test/std/containers/associative/set/set.cons/copy_assign.pass.cpp
index e21e07734d888..d299d625ae42f 100644
--- a/libcxx/test/std/containers/associative/set/set.cons/copy_assign.pass.cpp
+++ b/libcxx/test/std/containers/associative/set/set.cons/copy_assign.pass.cpp
@@ -80,5 +80,13 @@ int main(int, char**) {
assert(*std::next(mo.begin(), 2) == 3);
}
+ { // Test with std::pair, since we have some special handling for pairs inside __tree
+ std::set<std::pair<int, int>> a = {{1, 2}, {2, 3}, {3, 4}, {4, 5}};
+ std::set<std::pair<int, int>> b;
+
+ b = a;
+ assert(a == b);
+ }
+
return 0;
}
|
The CI failure is unrelated. Landing now, since this fixes a recent regression. |
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/11/builds/15379 Here is the relevant piece of the build log for the reference
|
…#140385) This has been introduced by llvm#134819, most likely due to a merge conflict I didn't resolve properly (I thought I did in that patch what I'm now doing here).
This has been introduced by #134819, most likely due to a merge conflict I didn't resolve properly (I thought I did in that patch what I'm now doing here).