Date: Fri, 06 Feb 2026 20:20:08 +0000
Wow okay, my eyes completely glazed over that line. Focused too much on the big paragraph I guess. Thanks for the quick response.
On Friday, February 6th, 2026 at 2:18 PM, Barry Revzin <barry.revzin_at_[hidden]> wrote:
> On Fri, Feb 6, 2026, 2:14 PM Keenan Horrigan via Std-Discussion <std-discussion_at_[hidden]> wrote:
>
>> I was playing around with the C++26 reflection stuff a bit, and realized that since std::meta::info is a scalar type, and all scalar types are trivially-copyable, then std::meta::info should be trivially-copyable and therefore bit_castable.
>>
>> Of course I have no real idea what that would actually result in, and indeed currently GCC trunk raises an error and says that it is unimplemented:
>>
>> /cefs/55/552701a8be9eb5ce4ab990a8_gcc-trunk-20260206/include/c++/16.0.1/bit: In function 'int main()':
>> in 'constexpr' expansion of 'std::bit_cast<array<char, 8>, std::meta::info>(info)'
>> <source>:7:63:
>> 7 | constexpr auto casted = std::bit_cast<std::array<char, 8>>(info);
>> | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~
>> /cefs/55/552701a8be9eb5ce4ab990a8_gcc-trunk-20260206/include/c++/16.0.1/bit:96:33: sorry, unimplemented: '__builtin_bit_cast' cannot be constant evaluated because the argument cannot be encoded
>> 96 | return __builtin_bit_cast(_To, __from);
>> | ^~~
>>
>> Theoretically as well, it could only be done during constant evaluation due to std::meta::info being a consteval-only type.
>>
>> I suppose it might come down to what is the "value representation" of a std::meta::info, which I believe is implementation-defined. But then even at the extreme, if it were somehow that there are zero bits in the value representation of a std::meta::info, then I believe it should just yield a sequence of indeterminate bytes in that case, no? Though looking at https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99637 it seems there may be some question as to whether that should still result in an error, anyways.
>>
>> But regardless, is this a gap in the standard? It doesn't appear very meaningful either way, but I'm curious.
>>
>> Thanks
>
> No, it's explicitly not bit-cast-able. Neither the source nor destination type is allowed to be consteval-only: https://eel.is/c++draft/bit.cast#2
>
> Barry
>
>>
On Friday, February 6th, 2026 at 2:18 PM, Barry Revzin <barry.revzin_at_[hidden]> wrote:
> On Fri, Feb 6, 2026, 2:14 PM Keenan Horrigan via Std-Discussion <std-discussion_at_[hidden]> wrote:
>
>> I was playing around with the C++26 reflection stuff a bit, and realized that since std::meta::info is a scalar type, and all scalar types are trivially-copyable, then std::meta::info should be trivially-copyable and therefore bit_castable.
>>
>> Of course I have no real idea what that would actually result in, and indeed currently GCC trunk raises an error and says that it is unimplemented:
>>
>> /cefs/55/552701a8be9eb5ce4ab990a8_gcc-trunk-20260206/include/c++/16.0.1/bit: In function 'int main()':
>> in 'constexpr' expansion of 'std::bit_cast<array<char, 8>, std::meta::info>(info)'
>> <source>:7:63:
>> 7 | constexpr auto casted = std::bit_cast<std::array<char, 8>>(info);
>> | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~
>> /cefs/55/552701a8be9eb5ce4ab990a8_gcc-trunk-20260206/include/c++/16.0.1/bit:96:33: sorry, unimplemented: '__builtin_bit_cast' cannot be constant evaluated because the argument cannot be encoded
>> 96 | return __builtin_bit_cast(_To, __from);
>> | ^~~
>>
>> Theoretically as well, it could only be done during constant evaluation due to std::meta::info being a consteval-only type.
>>
>> I suppose it might come down to what is the "value representation" of a std::meta::info, which I believe is implementation-defined. But then even at the extreme, if it were somehow that there are zero bits in the value representation of a std::meta::info, then I believe it should just yield a sequence of indeterminate bytes in that case, no? Though looking at https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99637 it seems there may be some question as to whether that should still result in an error, anyways.
>>
>> But regardless, is this a gap in the standard? It doesn't appear very meaningful either way, but I'm curious.
>>
>> Thanks
>
> No, it's explicitly not bit-cast-able. Neither the source nor destination type is allowed to be consteval-only: https://eel.is/c++draft/bit.cast#2
>
> Barry
>
>>
Received on 2026-02-06 20:20:15
