Problem:
- gcc-10 is generating the following warning at all standards:
test/format-test.cc: In member function 'virtual void UtilTest_BitCast_Test::TestBody()':
test/format-test.cc:108:42: error: useless cast to type 'uint64_t' {aka 'long long unsigned int'} [-Werror=useless-cast]
108 | s = fmt::detail::bit_cast<uint32_pair>(uint64_t(~0ull));
| ^~~~~~~~~~~~~~~
- gcc-8 is generating the following warning at all standards:
test/format-test.cc: In member function 'virtual void UtilTest_BitCast_Test::TestBody()':
test/format-test.cc:108:56: error: useless cast to type 'uint64_t' {aka 'long long unsigned int'} [-Werror=useless-cast]
s = fmt::detail::bit_cast<uint32_pair>(uint64_t(~0ull));
^
Solution:
- Cast 0 to a 64 unsigned bit int and then invert.
Co-authored-by: Jonathan Gopel <jgopel@quantlab.com>