Enable the -Wsign-compare warning to better support MSVC
llvm-svn: 289363
Cr-Mirrored-From: sso://chromium.googlesource.com/_direct/external/github.com/llvm/llvm-project
Cr-Mirrored-Commit: c71bd55b5dd20dd94c5b87a30adb1da7e81c5114
diff --git a/include/vector b/include/vector
index f5bd7d0..f175e47 100644
--- a/include/vector
+++ b/include/vector
@@ -3093,7 +3093,9 @@
>::type
vector<bool, _Allocator>::insert(const_iterator __position, _ForwardIterator __first, _ForwardIterator __last)
{
- difference_type __n = _VSTD::distance(__first, __last);
+ const difference_type __n_signed = _VSTD::distance(__first, __last);
+ _LIBCPP_ASSERT(__n_signed >= 0, "invalid range specified");
+ const size_type __n = static_cast<size_type>(__n_signed);
iterator __r;
size_type __c = capacity();
if (__n <= __c && size() <= __c - __n)