std::byte, when defined as an enum, needs to be given special treatment
with regards to its aliasing properties. An array of std::byte is
allowed to be used as storage for other types.
This fixes PR33916.
Differential D35824
[Sema] Implicitly apply the may_alias attribute to std::byte majnemer on Jul 24 2017, 4:58 PM. Authored by
Details
std::byte, when defined as an enum, needs to be given special treatment This fixes PR33916.
Diff Detail
Event TimelineComment Actions I would prefer to handle std::byte explicitly in the places where it matters, rather than adding an attribute to it and otherwise treating it like any other enumeration. We're going to want to be able to identify std::byte for warning emission and probably other codegen purposes too -- it's more a new fundamental type that happens to be defined in the library (like std::nullptr_t) than a type that just happens to be mayalias. Maybe a Type::is[Std]Byte, analogous to Type::isAlignValT? As far as I can see, nowhere in Clang cares about MayAliasAttr on enums other than CodeGenTBAA.cpp.
Comment Actions LGTM with a tweaked comment. Thanks!
|