Here a snippet of code :
// ...
std::deque<int> removed_ids;
// write 2 values in removed_ids
stack.remove(2,removed_ids);
ASSERT_EQ(removed_ids.size(),2);
int foo = 3;
// this is printed, and values make sense, e.g. foo is 3
std::cout << "IN | " << removed_ids.back()<< " | " << foo << "\n";
ASSERT_EQ(removed_ids.back(),foo);
// segmentation fault, never printed
std::cout << "OUT\n";
Running the tests always lead to a segmentation fault at the second ASSERT (the one comparing removed_ids.back() and foo) ; i.e. "OUT" is not printed in the terminal ("IN" is, followed by values of int that makes sense).
This is in a file running other tests, also doing some asserts, all working fine.
I am very confused of what may be happening.
I am on Ubuntu 16.04, c++11
Aucun commentaire:
Enregistrer un commentaire