我尽可能缩小了这一点,似乎是一个错误
#include <algorithm> #include <vector> int main(int argc,char *argv[]) { // Crashes std::vector<uint8_t> bs{1,0}; std::search_n(bs.begin(),bs.end(),3,1); // Does not crash std::vector<uint8_t> bs{1,2,1); return 0; }
我得到
Segmentation fault: 11
我希望我没有使用std :: search_n不正确:)
目前,使用LLDB的方法似乎不可行.
版本信息:
$clang --version Apple LLVM version 4.2 (clang-425.0.24) (based on LLVM 3.2svn) Target: x86_64-apple-darwin12.3.0 Thread model: posix
证据;)
13:06:47 ~/bug$cat bug.cc #include <algorithm> #include <vector> int main(int argc,char *argv[]) { std::vector<uint8_t> bs{1,1); // std::vector<uint8_t> bs{1,0}; // std::search_n(bs.begin(),1); return 0; } 13:06:52 ~/bug$clang++ -std=c++11 -stdlib=libc++ bug.cc -o bug 13:07:36 ~/bug$./bug Segmentation fault: 11 13:07:42 ~/bug$
解决方法
原文地址:https://www.jb51.cc/c/114471.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。