https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114706
--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> --- The master branch has been updated by Jakub Jelinek <ja...@gcc.gnu.org>: https://gcc.gnu.org/g:79ff53453e88e40c4f2ecf6f7f7409afc41b46fc commit r14-9987-g79ff53453e88e40c4f2ecf6f7f7409afc41b46fc Author: Jakub Jelinek <ja...@redhat.com> Date: Tue Apr 16 09:39:19 2024 +0200 c++: Handle ARRAY_TYPE in check_bit_cast_type [PR114706] https://eel.is/c++draft/bit.cast#3 says that std::bit_cast isn't constexpr if To, From and the types of all subobjects have certain properties which the check_bit_cast_type checks (such as it isn't a pointer, reference, union, member pointer, volatile). The function doesn't cp_walk_tree though, so I've missed one important case, for ARRAY_TYPEs we need to recurse on the element type. I think we don't need to handle VECTOR_TYPEs/COMPLEX_TYPEs, because those will not have a pointer/reference/union/member pointer in the element type and if the element type is volatile, I think the whole derived type is volatile as well. 2024-04-16 Jakub Jelinek <ja...@redhat.com> PR c++/114706 * constexpr.cc (check_bit_cast_type): Handle ARRAY_TYPE. * g++.dg/cpp2a/bit-cast17.C: New test.