Debian Codegraph @

gcc/testsuite/g++.dg/ext/attr-aligned01.C

raw
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>
7 void type_alignment(const T&) {
8 struct S { char c; T t; } s;
9 SA(__builtin_offsetof (S,t) - __builtin_offsetof (S,c) == 1);
10 }
11
12 template <class T> struct A { char c; T t; };
13
14 int 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( __builtin_offsetof (__typeof(a),t)
21 - __builtin_offsetof (__typeof(a),c) == 1);
22
23 aligned z;
24 type_alignment(z); // { dg-warning "ignoring attributes" "" { xfail *-*-* } }
25 type_alignment<unaligned ALIGNED(8)>(z); // { dg-warning "ignoring attributes" "" { xfail *-*-* } }
26 }