OSDN Git Service

2001-07-11 Ben Elliston <bje@redhat.com>
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / g++.old-deja / g++.other / enum5.C
1 // Copyright (C) 2001 Free Software Foundation, Inc.
2 // Contributed by Ben Elliston <bje@redhat.com>
3
4 // PR 80: Packed enums use minimum required storage.
5
6 extern "C" void abort();
7
8 enum numbers { one, two, three } __attribute__ ((packed)) nums;
9 enum colours { red = 1000, green, blue } __attribute__ ((packed)) cols;
10 enum __attribute__ ((packed)) conditions { fine, rain, cloudy } forecast;
11
12 int
13 main()
14 {
15   if (sizeof (nums) != 1)
16     abort ();
17
18   if (sizeof (cols) != 2)
19     abort ();
20
21   if (sizeof (forecast) != 1)
22     abort ();
23
24   return 0;
25 }