Bug #859
closedOFVector unit test fails on VS2017 in DEBUG mode.
100%
Description
The first test in ofstd/tests/tvec.cc fails when STL vectors are enabled and the compiler is VS2017 in DEBUG mode.
[The reason] is that the test case code is non-compliant with the C++ standard in a subtle way: For some reason it is defined that a past-the-end iterator (such as the result from the first begin() call) is invalidated by push_back even if no reallocation occurs. Don’t ask me why, but apparently Microsoft is taking this restriciton seriously and actually checks it in their iterator-checking mechanism which is active in Debug mode. So it is not the actual OFCHECK macro that fails, but the operator== triggers an assert inside the Microsoft runtime as the ‘it’ iterator is considered invalid.
Reported 2018-11-29 by Bengt Gustafsson <Bengt.Gustafsson@contextvision.se>.