1 // PR c++/48138 2 3 #define ALIGNED(x) __attribute__((aligned(x))) 4 #define SA(X) int ar[(X)?1:-1]; 5 6 template<typename T> type_alignment(const T &)7void type_alignment(const T&) { 8 struct { char c; T t; } s; 9 SA((char*)&s.t - (char*)&s.c == 1); 10 } 11 12 template <class T> struct A { char c; T t; }; 13 main()14int main() { 15 typedef char unaligned[15]; 16 typedef char aligned[15] ALIGNED(8); 17 18 A<aligned> a; // { dg-warning "ignoring attributes" } 19 20 SA((char*)&a.t - (char*)&a.c == 1); 21 22 aligned z; 23 type_alignment(z); // { dg-warning "ignoring attributes" "" { xfail *-*-* } } 24 type_alignment<unaligned ALIGNED(8)>(z); // { dg-warning "ignoring attributes" "" { xfail *-*-* } } 25 } 26