aboutsummaryrefslogtreecommitdiff
path: root/libgo
diff options
context:
space:
mode:
authorMarek Polacek <polacek@redhat.com>2020-02-24 09:19:01 -0500
committerMarek Polacek <polacek@redhat.com>2020-02-26 10:01:51 -0500
commitd6ff22074126d38829f25981de9d6940cd2a234c (patch)
tree3667d1402d01145c09dccff8621a14b750f25fd5 /libgo
parent759bd406a2b900dd323571c3855a64f885e6b3b7 (diff)
downloadgcc-d6ff22074126d38829f25981de9d6940cd2a234c.zip
gcc-d6ff22074126d38829f25981de9d6940cd2a234c.tar.gz
gcc-d6ff22074126d38829f25981de9d6940cd2a234c.tar.bz2
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 <polacek@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.
Diffstat (limited to 'libgo')
0 files changed, 0 insertions, 0 deletions