2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / gcc / testsuite / g++.dg / ext / attrib5.C
blobf67510dabc76236b0e09681a324df2aed05b5517
1 // There were two related problems here, depending on the vintage.  At
2 // one time:
3 //
4 //    typedef struct A { ... } A __attribute__ ((aligned (16)));
5 //
6 // would cause original_types to go into an infinite loop.  At other
7 // times, the attributes applied to an explicit typedef would be lost
8 // (check_b3 would have a negative size).
10 // First check that the declaration is accepted and has an effect.
11 typedef struct A { int i; } A __attribute__ ((aligned (16)));
12 int check_A[__alignof__ (A) >= 16 ? 1 : -1];
14 // Check that the alignment is only applied to the typedef.
15 struct B { int i; };
16 struct B b1;
17 typedef struct B B __attribute__((aligned (16)));
18 struct B b2;
19 B b3;
20 int check_b1[__alignof__ (b1) == __alignof__ (b2) ? 1 : -1];
21 int check_b3[__alignof__ (b3) >= 16 ? 1 : -1];