forked from OSchip/llvm-project
Fix PR 19663. Some calls to find(vector<bool>) were returning iterators that were subtly invalid (didn't compare equal). Thanks to Erik Verbruggen for the report (and diagnosis)
llvm-svn: 208096
This commit is contained in:
parent
8fbbfbbec3
commit
0fc6e981b0
|
@ -174,7 +174,7 @@ __find_bool_true(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type
|
|||
if (__b)
|
||||
return _It(__first.__seg_, static_cast<unsigned>(_VSTD::__ctz(__b)));
|
||||
if (__n == __dn)
|
||||
return _It(__first.__seg_, __first.__ctz_ + __n);
|
||||
return __first + __n;
|
||||
__n -= __dn;
|
||||
++__first.__seg_;
|
||||
}
|
||||
|
@ -210,7 +210,7 @@ __find_bool_false(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type
|
|||
if (__b)
|
||||
return _It(__first.__seg_, static_cast<unsigned>(_VSTD::__ctz(__b)));
|
||||
if (__n == __dn)
|
||||
return _It(__first.__seg_, __first.__ctz_ + __n);
|
||||
return __first + __n;
|
||||
__n -= __dn;
|
||||
++__first.__seg_;
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@ int main()
|
|||
std::vector<bool> b(i,true);
|
||||
std::vector<bool>::iterator j = std::find(b.begin()+1, b.end(), false);
|
||||
assert(j-b.begin() == i);
|
||||
assert(b.end() == j);
|
||||
}
|
||||
}
|
||||
{
|
||||
|
@ -33,6 +34,7 @@ int main()
|
|||
std::vector<bool> b(i,false);
|
||||
std::vector<bool>::iterator j = std::find(b.begin()+1, b.end(), true);
|
||||
assert(j-b.begin() == i);
|
||||
assert(b.end() == j);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue