This is an archive of the discontinued LLVM Phabricator instance.

Make __has_unique_object_representations reject empty union types.
ClosedPublic

Authored by EricWF on Feb 2 2018, 12:29 PM.

Details

Summary

Clang incorrectly reports empty unions as having a unique object representation. However, this is not correct since sizeof(EmptyUnion) == 1 AKA it has 8 bits of padding. Therefore it should be treated the same as an empty struct and report false.

@erichkeane also suggested this fix should be merged into the 6.0 release branch, so the initial release of __has_unique_object_representations is as bug-free as possible.

Diff Detail

Repository
rL LLVM

Event Timeline

EricWF created this revision.Feb 2 2018, 12:29 PM
erichkeane accepted this revision.Feb 2 2018, 12:31 PM

Yep, LGTM, thanks!

This revision is now accepted and ready to land.Feb 2 2018, 12:31 PM
This revision was automatically updated to reflect the committed changes.
This revision was automatically updated to reflect the committed changes.