Closed Lastique closed 1 month ago
Bisect shows that the first bad commit is 1a4a205ea6ef7b4e67a2faab7c7d745711807695. Reverting this commit on 1.85 (with resolved conflicts) fixes the crash.
Thanks for the report!
I think the issue is produced because flat_map used UB in the implementation, long ago, when C++03 compilers had no movable std::pair type and the class was designed to achieve move emulation in those compilers. The following commit should fix the issue, your example seems to work after the commit, but I didn't want to close the issue without having your feedback:
https://github.com/boostorg/container/commit/20ad12f20e661978e90dc7f36d8ab8ac05e5a5a9
Thanks, the commit does fix the problem.
It is probably worth attaching this patch to the 1.85.0 release notes.
Closing this issue as fixed.
Consider this test code:
This crashes with:
valgrind
also shows a number of invalid memory accesses, see the attached log:test_flat_map.log
This code works correctly in Boost 1.84.0. It also doesn't crash if compiled with
-O0
.gcc 11.4.0, Kubuntu 22.04.