-
Notifications
You must be signed in to change notification settings - Fork 17k
Common initial sequence is not respected when alignas is used #186040
Copy link
Copy link
Open
Labels
clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"diverges-from:edgDoes the clang frontend diverge from edg compiler on this issueDoes the clang frontend diverge from edg compiler on this issuediverges-from:gccDoes the clang frontend diverge from gcc on this issueDoes the clang frontend diverge from gcc on this issuediverges-from:msvcDoes the clang frontend diverge from msvc on this issueDoes the clang frontend diverge from msvc on this issue
Metadata
Metadata
Assignees
Labels
clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"diverges-from:edgDoes the clang frontend diverge from edg compiler on this issueDoes the clang frontend diverge from edg compiler on this issuediverges-from:gccDoes the clang frontend diverge from gcc on this issueDoes the clang frontend diverge from gcc on this issuediverges-from:msvcDoes the clang frontend diverge from msvc on this issueDoes the clang frontend diverge from msvc on this issue
Type
Fields
Give feedbackNo fields configured for issues without a type.
The following program demonstrates the issue:
Clang recognizes that C and D are both layout-compatible standard layout classes, therefore all of their members should be part of the common initial sequence. However, Clang does not seem to lay out their respective z members so that they have the same offset. There seems to be two possible solutions here. First, reject that C and D are layout-compatible and possibly also further reject that A and B are layout-compatible. Second, whenever a standard layout class is used as a member it must be aligned to the maximum possible alignment so that any alignment differences do not matter.
See also cplusplus/draft#8787.