aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.old-deja/g++.other/enum5.C
blob: bee7b985b5a9dc5bc49076ca705f6683c8965961 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// { dg-do run }
// Copyright (C) 2001, 2003 Free Software Foundation, Inc.
// Contributed by Ben Elliston <bje@redhat.com>

// PR 80: Packed enums use minimum required storage.

extern "C" void abort();

enum numbers { one, two, three } __attribute__ ((packed)) nums; // { dg-bogus "" "" { xfail *-*-* } } 
enum colours { red = 1000, green, blue } __attribute__ ((packed)) cols; // { dg-bogus "" "" { xfail *-*-* } } 
enum __attribute__ ((packed)) conditions { fine, rain, cloudy } forecast; // { dg-bogus "" "" { xfail *-*-* } } 

int
main()
{
  if (sizeof (nums) != 1)
    abort ();

  if (sizeof (cols) != 2)
    abort ();

  if (sizeof (forecast) != 1) // { dg-bogus "" "" { xfail *-*-* } }
    abort ();

  return 0;
}