With the example below g++ only TEST prints followed by a segfault, however on clang++ will print out both TEST and TEST2
I'm compiling the following code as such on clang
clang++ -std=c++11 -Wall test.cpp -o test
and on g++
g++ -std=c++11 -Wall test.cpp -o bug
#include <iostream>
#include <list>
using namespace std;
int main()
{
list<string> queue;
queue.push_back("TEST");
queue.push_back("TEST2");
for (auto ci = queue.begin(); ci != queue.end(); ++ci) {
cout << *ci << " " << endl;
queue.remove("TEST");
}
return 0;
}
Compiler version info:
$ clang++ --version
Apple LLVM version 6.0 (clang-600.0.56) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin15.0.0
Thread model: posix
gcc version 5.2.1 20151010 (Ubuntu 5.2.1-22ubuntu2)
Aucun commentaire:
Enregistrer un commentaire