2008-05-30 Vladimir Makarov <vmakarov@redhat.com>
[official-gcc.git] / gcc / testsuite / g++.old-deja / g++.jason / enum6.C
blob7be0cd868cc1723d52947b9c86457872f344fd43
1 // { dg-do run  }
2 // { dg-options "-fshort-enums" }
4 // On ARM EABI targets this testcase will cause a warning to be emitted
5 // whilst EABI attributes are being merged at link time unless
6 // the --no-enum-size-warning option is passed to the linker.  Whilst the
7 // enum-size attributes should only be emitted if there are values of
8 // enum type that can escape the compilation unit, gcc cannot currently
9 // detect this; if this facility is added then this linker option should
10 // not be needed.  arm-*-linux*eabi should be a good approximation to
11 // those platforms where the EABI supplement defines enum values to be
12 // 32 bits wide.
13 // { dg-options "-fshort-enums -Wl,--no-enum-size-warning" { target arm*-*-linux*eabi } }
15 #include <limits.h>
17 enum A { a1 = 0x7fffffff };
18 enum B { b1 = 0x80000000 };
19 enum C { c1 = -1, c2 = 0x80000000 };
20 enum D { d1 = CHAR_MIN, d2 = CHAR_MAX };
21 enum E { e1 = CHAR_MIN, e2 = CHAR_MIN };
23 main()
25   return (sizeof (A) != 4 || sizeof (B) != 4 || sizeof (C) != 8
26           || sizeof (D) != 1 || sizeof (E) != 1);