https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93803
--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Marek Polacek <mpola...@gcc.gnu.org>: https://gcc.gnu.org/g:d6ff22074126d38829f25981de9d6940cd2a234c commit r10-6865-gd6ff22074126d38829f25981de9d6940cd2a234c Author: Marek Polacek <pola...@redhat.com> Date: Mon Feb 24 09:19:01 2020 -0500 c++: Fix ICE with constexpr init and [[no_unique_address]] [PR93803] Here we crash when constexpr-initializing a class member of empty class type with [[no_unique_address]]. Without the attribute we would have a ctor (that initializes bar) of the form { .D.2173 = { .x = {} } } but with the attribute reduced_constant_expression_p gets { .x = {} } That means that "idx != field" is true for the latter and we see that foo, the base class of bar, is an empty class, so we want to look at the next initializable field (since empty class fields may not have an initializer). But in this case there are no more, therefore accessing DECL_CHAIN (field) crashes. Long story short, we need to avoid a crash on a null field when we're initializing a class that only contains an empty base class. While poking into this I discovered c++/93898, but that's a different problem. 2020-02-26 Marek Polacek <pola...@redhat.com> PR c++/93803 - ICE with constexpr init and [[no_unique_address]]. * constexpr.c (reduced_constant_expression_p): Don't crash on a null field. * g++.dg/cpp2a/constexpr-init16.C: New test. * g++.dg/cpp2a/constexpr-init17.C: New test.