-
-
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
Visual Studio 14 Debug assertion failed #125
Comments
Hi @ruslo, unfortunately, I have no experience with MSVC. There have been numerous attempts to have the code work with MSVC before, but it is breaking again and again (see https://ci.appveyor.com/project/nlohmann/json). It would be great if you could explain to me what is wrong in the code or better propose a fix. Thanks, |
The last time I've tried to figure out what is happening I've noticed a hairy chain of |
I've been taking a look at this issue.
To me the problem is 3) My proposed resolution is to remove that streaming operator for iterators (which doesn't make sense). With that, the code compiles and I can see other tests failing for other reasons, which I'll try to investigate. |
Doh! I was not running the tests in the right directory. Now, after removing operator<< for iterators, I see only two tests failing in Debug mode with VS2015:
If I understand the message, it seems the json iterators are expected to have |
It doesn't really make sense to stream an iterator. Besides, this was causing trouble in MSVC in Debug mode (see nlohmann#125)
Pull Request ready! |
All the test pass in Release mode. |
All the test pass in Release mode. The debug builds in Visual Studio have a lot of extra iterator debugging code. The release builds just silently ignore various types of iterator errors. |
I'm talking about |
json::iterator contains, by default, std::map::iterator and std::vector::iterator. There's probably something in one of those that would allow a copy construction to throw. I think that at least in the past the iterator registered itself with the container, which allowed the container to mark the iterators as invalid when the container was destroyed. This would probably require storing a vector of iterator pointers. |
OK, it seems that I'd suggest removing that check if MSVC in Debug |
That makes sense to me. |
STL iterators used by json::iterator don't pass this test in Debug mode. The test does pass in Release mode, so I felt the best thing to do was selectively disable that test.
Another PR ready! |
Hi! |
In fact I also have the related PR #130 pending review. |
disabled "CopyAssignable" test for MSVC in Debug mode, see #125
removed stream operator for iterator, resolution for #125
Yes, version from |
I've tried to run unit-test with Visual Studio 14 2015 generator and got runtime error:
Last backtrace entry comes from:
json/src/json.hpp
Line 5119 in 0a81353
which came from:
json/test/unit.cpp
Line 2879 in 0a81353
The text was updated successfully, but these errors were encountered: