Debian Codegraph @

gcc/testsuite/g++.old-deja/g++.other/enum5.C

raw
1 // { dg-do run }
2 // Copyright (C) 2001, 2003, 2004 Free Software Foundation, Inc.
3 // Contributed by Ben Elliston <[email protected]>
4
5 // PR 80: Packed enums use minimum required storage.
6
7 extern "C" void abort();
8
9 enum numbers { one, two, three } __attribute__ ((packed)) nums;
10 enum colours { red = 1000, green, blue } __attribute__ ((packed)) cols;
11 enum conditions { fine, rain, cloudy } __attribute__ ((packed)) forecast;
12
13 int
14 main()
15 {
16 if (sizeof (nums) != 1)
17 abort ();
18
19 if (sizeof (cols) != 2)
20 abort ();
21
22 if (sizeof (forecast) != 1)
23 abort ();
24
25 return 0;
26 }