Fix PR#35119 : set_union misbehaves with move_iterators. Thanks to Denis Yaroshevskiy for both the bug report and the fix.
llvm-svn: 316914
Cr-Mirrored-From: sso://chromium.googlesource.com/_direct/external/github.com/llvm/llvm-project
Cr-Mirrored-Commit: 05da5b0205aeada52a6838353d214db3723c79c7
diff --git a/include/algorithm b/include/algorithm
index 282083a..f5776b4 100644
--- a/include/algorithm
+++ b/include/algorithm
@@ -5547,9 +5547,9 @@
}
else
{
- *__result = *__first1;
if (!__comp(*__first1, *__first2))
++__first2;
+ *__result = *__first1;
++__first1;
}
}