Silence type punning warning reported by gcc 6.5 #35849
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
SUMMARY: None
Purpose of change
Travis builds under GCC 6.5 have been failing due to a type punning warning.
https://travis-ci.org/CleverRaven/Cataclysm-DDA/jobs/619431840
Describe the solution
Silence this class of warnings when building under anything from the GCC 6 family.
Describe alternatives you've considered
There are new versions of colony that may have addressed this, but I don't want to re-import right now.
Testing
Ideally reproduce and test this on a GCC 6.5 system, but IDK how straightforward that will be.
Additional context
Text of the warning:
In file included from colony_test.cpp:8:0:
../src/colony.h: In instantiation of ‘void cata::colony<element_type, element_allocator_type, element_skipfield_type>::fill_skipblock(const element_type&, cata::colony<element_type, element_allocator_type, element_skipfield_type>::aligned_pointer_type, cata::colony<element_type, element_allocator_type, element_skipfield_type>::skipfield_pointer_type, cata::colony<element_type, element_allocator_type, element_skipfield_type>::skipfield_type) [with element_type = int; element_allocator_type = std::allocator; element_skipfield_type = short unsigned int; cata::colony<element_type, element_allocator_type, element_skipfield_type>::aligned_pointer_type = std::aligned_storage<4ul, 4ul>::type*; cata::colony<element_type, element_allocator_type, element_skipfield_type>::skipfield_pointer_type = short unsigned int*; cata::colony<element_type, element_allocator_type, element_skipfield_type>::skipfield_type = short unsigned int]’:
../src/colony.h:1555:43: required from ‘void cata::colony<element_type, element_allocator_type, element_skipfield_type>::insert(cata::colony<element_type, element_allocator_type, element_skipfield_type>::size_type, const element_type&) [with element_type = int; element_allocator_type = std::allocator; element_skipfield_type = short unsigned int; cata::colony<element_type, element_allocator_type, element_skipfield_type>::size_type = long unsigned int]’
colony_test.cpp:689:39: required from here
../src/colony.h:1463:34: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]