alignas(1) int n1; alignas(1) alignas(2) int n2; alignas(1) alignas(2) alignas(4) int n3; alignas(1) alignas(2) alignas(0) int n4; alignas(1) alignas(2) int n5 alignas(4); alignas(1) alignas(4) int n6 alignas(2); alignas(1) int n7 alignas(2), n8 alignas(4); alignas(8) int n9 alignas(2); alignas(1) extern int n10;
typedef __attribute__((aligned(16))) int IntAlign16;
enum E6 : IntAlign16 {};
static_assert(alignof(E6) == 4, "");
struct S1 {
alignas(8) int n;
};
struct alignas(2) S2 { int n;
};
struct alignas(2) S3 { S1 s1;
};
struct alignas(2) S4 : S1 { };
struct S5 : S1 {
alignas(2) S1 s1; };
struct S6 {
S1 s1;
};
struct S7 : S1 {
};
struct alignas(2) alignas(8) alignas(1) S8 : S1 {
};
S1 s1 alignas(4); S6 s6 alignas(4); S7 s7 alignas(4);
template<int N, int M, typename T>
struct alignas(N) X { alignas(M) T t; };
template struct X<1, 1, char>;
template struct X<4, 1, char>;
template struct X<1, 2, char>; template struct X<1, 1, short>; template struct X<2, 1, short>; template struct X<2, 2, short>;
template struct X<16, 8, S1>;
template struct X<4, 4, S1>;
template<int N, typename T>
void f() {
alignas(N) T v; };
template void f<1, char>();
template void f<2, char>();
template void f<1, short>(); template void f<2, short>();