-
-
Notifications
You must be signed in to change notification settings - Fork 6.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compiling with _GLIBCXX_DEBUG yields iterator-comparison warnings during tests #492
Comments
I can confirm your findings with GCC 7 (7.0.1 20170305 (experimental)) running |
The culprit is the following test: SECTION("insert nothing (count = 0)")
{
auto pos = j_array.end();
auto it = j_array.insert(j_array.end(), 0, 5);
CHECK(j_array.size() == 4);
CHECK(it == pos);
CHECK(j_array == json({1, 2, 3, 4}));
} I wanted to check that the return value of the |
This is the fix: auto it = j_array.insert(j_array.end(), 0, 5);
CHECK(j_array.size() == 4);
// the returned iterator points to the first inserted element;
// there were 4 elements, so it should point to the 5th
CHECK(it == j_array.begin() + 4);
CHECK(j_array == json({1, 2, 3, 4})); With it, all tests compile and execute without error with |
@mikecrowe Can you check whether commit 758c4ad fixed the issue for you? |
The iterator failures are no longer occurring for me. (I do see other failures that appear to be due to locale stuff. These happen with both GCC4.9 (Debian Jessie) and GCC6.3 (Debian Stretch.) I can create a separate issue for them if you aren't already aware of them.) Thanks! |
Thanks, so I can close this issue. No I am not aware of other problems, so I would be happy if you could add a new issue for them. |
I've been suffering from some strange problems when compiling with GCC6 and -Og. So, I tried adding:
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_GLIBCXX_DEBUG")
to CMakeLists.txt with v2.1.0 in order to enable libstdc++ debugging.
When I do this and run "make test" I get various errors about iterator comparisons (note that this was using my host compiler so it's actually GCC4.9):
e.g.:
The text was updated successfully, but these errors were encountered: