[C++ PATCH] Deprecate -ffriend-injection
[official-gcc.git] / gcc / testsuite / gcc.dg / pack-test-3.c
blobbd78fad9b9adca7c2ce80998b092061f757fe637
1 /* { dg-do compile } */
3 /* Copyright (C) 2003 Free Software Foundation, Inc.
4 Contributed by Nathan Sidwell 15 Jul 2003 <nathan@codesourcery.com> */
6 /* you should not be able to pack a typedef to a struct, only the
7 underlying struct can be packed. */
9 /* ok */
10 struct u1
12 char field1;
13 short field2;
14 int field3;
17 /* ok */
18 typedef struct p1 {
19 char field1;
20 short field2;
21 int field3;
22 } __attribute__ ((packed)) p1_t1;
24 /* ok */
25 typedef struct __attribute__ ((packed)) p2 {
26 char field1;
27 short field2;
28 int field3;
29 } p2_t1;
31 int ary1[sizeof (struct p1) == sizeof (p1_t1) ? 1 : -1];
32 int ary2[sizeof (struct p2) == sizeof (p2_t1) ? 1 : -1];
33 int ary3[sizeof (struct p1) == sizeof (struct p2) ? 1 : -1];
35 /* not ok */
36 typedef struct u1 __attribute__ ((packed)) u1_t1; /* { dg-warning "attribute ignored" }*/
37 typedef struct u1 u1_t2 __attribute__ ((packed)); /* { dg-warning "attribute ignored" }*/
39 typedef struct p3 {
40 char field1;
41 short field2;
42 int field3;
43 } p3_t1 __attribute__ ((packed)); /* { dg-warning "attribute ignored" }*/