The reinterpret_cast is problematic because 1. it violates the strict aliasing assumption and 2. the types can be of different size. In particular, BinaryFloatingPointNumber is always a power-of-2 whereas the source type can be smaller (like for 80-bit real). Therefore, when dereferencing the BinaryFloatingPointNumber, the accesses exceeds the source type's allocation size.
Fix by using memcpy to a zero-initialized buffer of the larger size.
Found using AddressSanitizer.
clang-tidy: error: constexpr variable 'bits' must be initialized by a constant expression [clang-diagnostic-error]
not useful