https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65352
--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> --- Oops, that should be: --- a/libstdc++-v3/include/std/array +++ b/libstdc++-v3/include/std/array @@ -58,9 +58,9 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER { struct _Type { }; - static constexpr _Tp& - _S_ref(const _Type&, std::size_t) noexcept - { return *static_cast<_Tp*>(nullptr); } + static _Tp& + _S_ref(const _Type& __t, std::size_t) noexcept + { return reinterpret_cast<_Tp&>(const_cast<_Type&>(__t)); } }; /** I think it's OK to make it non-constexpr, because _S_ref only needs to be constexpr for functions which access an element, which are also invalid for the zero-size array.