On Fri, Feb 24, 2023 at 11:54:54AM +0000, Jonathan Wakely wrote: > > The comment needs adjustment and don't we need > > alignas (T) alignas (vec_prefix) ? > > Yes. If alignas(T) is less than the natural alignment then this will > be an error. We want it to be the larger of the two alignments, so we > need to specify both.
Seems g++ doesn't diagnose this but clang++ does: struct S { int a; }; alignas (char) alignas (S) S s; alignas (char) S t; $ g++ -S -o /tmp/1.s /tmp/1.C -pedantic-errors $ clang++ -S -o /tmp/1.s /tmp/1.C -pedantic-errors /tmp/1.C:3:1: error: requested alignment is less than minimum alignment of 4 for type 'S' alignas (char) S t; ^ 1 error generated. Jakub