Fix miscompile with [[no_unique_address]] struct fields.
authorRichard Smith <richard@metafoo.co.uk>
Wed, 29 Jun 2022 20:06:42 +0000 (13:06 -0700)
committerRichard Smith <richard@metafoo.co.uk>
Wed, 29 Jun 2022 20:08:40 +0000 (13:08 -0700)
commitdcea10c3c6ac963387e53f918c3616b64cb82e8d
tree7d935882db666f21c9e1c3af95c9cdca095f535a
parent5086e05bb0cdeef68b110336dba2fe229be95110
Fix miscompile with [[no_unique_address]] struct fields.

If a zero-sized field has a non-trivial initializer, it should prevent
the overall struct initialization from being folded to a constant during
IR generation. Don't just ignore zero-sized fields entirely in IR
constant emission.
clang/lib/CodeGen/CGExprConstant.cpp
clang/test/CodeGenCXX/no-unique-address.cpp