https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101194
--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-11 branch has been updated by Patrick Palka <ppa...@gcc.gnu.org>: https://gcc.gnu.org/g:1b57a9fb90552e52f2a121e2ae12534484b39859 commit r11-8731-g1b57a9fb90552e52f2a121e2ae12534484b39859 Author: Patrick Palka <ppa...@redhat.com> Date: Wed Jun 30 20:44:52 2021 -0400 c++: cxx_eval_array_reference and empty elem type [PR101194] Here the initializer for x is represented as an empty CONSTRUCTOR due to its empty element type. So during constexpr evaluation of the ARRAY_REF x[0], we end up trying to value initialize the omitted element at index 0, which fails because the element type is not default constructible. This patch makes cxx_eval_array_reference specifically handle the case where the element type is an empty type. PR c++/101194 gcc/cp/ChangeLog: * constexpr.c (cxx_eval_array_reference): When the element type is an empty type and the corresponding element is omitted, just return an empty CONSTRUCTOR instead of attempting value initialization. gcc/testsuite/ChangeLog: * g++.dg/cpp0x/constexpr-empty16.C: New test. (cherry picked from commit a688c284dd3848b6c4ea553035f0f9769fb4fbc9)