https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94569
Bug ID: 94569 Summary: alignas(object) with a weaker (smaller) alignment than the alignas(type) of it's type compiles, inconsistent with the C++ standard Product: gcc Version: 10.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: sinbal2l at gmail dot com Target Milestone: --- The standard specifies: >From the standard: [9.12.2 Alignment specifier, section 6, pg 226] If the defining declaration of an entity has an alignment-specifier, any non-defining declaration of that entity shall either specify equivalent alignment or have no alignment-specifier. Conversely, if any declaration of an entity has an alignment-specifier, every defining declaration of that entity shall specify an equivalent alignment. But on the latest revision, this compiles: typedef struct alignas(32){ int i; }U; int main() { alignas(16) U my_u; // alignas(obj) of a weaker alignment than the type. cout << "alignof(my_u): " << alignof(my_u) << endl; cout << "alignof (decltype(my_u))" << alignof (decltype(my_u)) << endl; } https://godbolt.org/z/2uNAag P.S. thank you very much for doing such a great job!