http://llvm.org/bugs/show_bug.cgi?id=16816
Bug ID: 16816
Summary: Unexpected iterator value returned by std::find
specialization on std::vector<bool>
Product: libc++
Version: unspecified
Hardware: PC
OS: All
Status: NEW
Severity: normal
Priority: P
Component: All Bugs
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected]
Classification: Unclassified
Created attachment 10997
--> http://llvm.org/bugs/attachment.cgi?id=10997&action=edit
Source for console application showing problem in std::find with
std::vector<bool>.
I'm using std::find on an std::vector<bool> instance. I'm finding that the
iterator returned is not what I expect (actually it's out of range). The
essence of the code sample is:
std::vector<bool> b(5,false);
auto it = std::find(b.begin()+1, b.end());
// 'it' is now positioned at b.begin() + 64! But b.size()==5!
It looks like the std::find(..) specialization for std::vector<bool> is broken
under certain conditions (certain sizes of std::vector<bool>?).
The full sample is attached as a single source file that can be compiled as a
console application. I've also compared the result using an online compiler
(GCC 4.8? libstdc++?), and this can be found at:
http://ideone.com/RyI8sJ
I'm using libcxx version found in XCode 4.6.3 on OSX (_LIBCPP_VERSION = 1101).
I using Clang compiler with settings:
clang++ -std=c++11 -stdlib=libc++ main.cpp
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs