-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Open
Labels
A-alignArea: alignment control (`repr(align(N))` and so on)Area: alignment control (`repr(align(N))` and so on)A-enumArea: Enums (discriminated unions, or more generally ADTs (algebraic data types))Area: Enums (discriminated unions, or more generally ADTs (algebraic data types))A-reprArea: the `#[repr(stuff)]` attributeArea: the `#[repr(stuff)]` attributeC-bugCategory: This is a bug.Category: This is a bug.T-langRelevant to the language teamRelevant to the language team
Description
repr(align) on enums is implemented as described in the reference:
The align modifier can also be applied on an enum. When it is, the effect on the enum's alignment is the same as if the enum was wrapped in a newtype struct with the same align modifier.
But this is not how aligned enums work in Clang, GCC, and MSVC
- GCC ignores alignment requests on enums.
- Clang sets the alignment to the requested alignment even if this decreases the alignment. The size is unaffected.
- MSVC increases the alignment to the requested alignment. The size is unaffected.
Metadata
Metadata
Assignees
Labels
A-alignArea: alignment control (`repr(align(N))` and so on)Area: alignment control (`repr(align(N))` and so on)A-enumArea: Enums (discriminated unions, or more generally ADTs (algebraic data types))Area: Enums (discriminated unions, or more generally ADTs (algebraic data types))A-reprArea: the `#[repr(stuff)]` attributeArea: the `#[repr(stuff)]` attributeC-bugCategory: This is a bug.Category: This is a bug.T-langRelevant to the language teamRelevant to the language team