https://bugs.llvm.org/show_bug.cgi?id=51925
Richard Smith <richard-l...@metafoo.co.uk> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |INVALID
Status|NEW |RESOLVED
--- Comment #1 from Richard Smith <richard-l...@metafoo.co.uk> ---
This behavior is correct. Your type `Item` contains 9 bytes with determinate
values, followed by three padding bytes which have indeterminate values, but
your type `Data` contains a 12 byte array. The `bit_cast` therefore leaves the
last three bytes of that array with indeterminate values.
But because `bit_cast` returns by value, this means your program attempts to
copy those three `char` objects that have indeterminate values. Copying an
indeterminate value is only permitted for unsigned narrow character types and
`std::byte`, as the diagnostic says.
So this call to `bit_cast` results in undefined behavior, which means it's not
permitted in a constant expression.
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs