Workaround to self move assign error with _GLIBCXX_DEBUG #47546
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Build "Workaround to self move assign error with _GLIBCXX_DEBUG"
Purpose of change
_GLIBCXX_DEBUG
tests are failing (for example see https://travis-ci.org/github/CleverRaven/Cataclysm-DDA/jobs/758957947) because of a bug inlibstdc++
(https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85828) that whenstd::shuffle
insrc/item_group.cpp
swaps an element to itself, the program is terminated with errorDescribe the solution
Add a workaround brought up by Jonathan Wakely in https://stackoverflow.com/questions/22915325/avoiding-self-assignment-in-stdshuffle that disables self move assignment check in
libstdc++
.Describe alternatives you've considered
Disable
_GLIBCXX_DEBUG
test in Travis CI test matrix until GCC 11 is released.Testing
Does not crash or error when compiling with
CXXFLAGS=-D_GLIBCXX_DEBUG
.Additional context
The fix (https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=c2fb0a1a2e7a0fb15cf3cf876f621902ccd273f0) is in GCC
master
branch and will be shipped with GCC 11 release.