2014-11-26 Andreas Tobler <andreast@gcc.gnu.org>
[official-gcc.git] / gcc / testsuite / g++.old-deja / g++.jason / enum6.C
blobc5bcec9ad7a5bb4cd0c992f8092f0cbc11328e81
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.
11 // { dg-options "-fshort-enums -Wl,--no-enum-size-warning" { target arm_eabi } }
13 #include <limits.h>
15 enum A { a1 = 0x7fffffff };
16 enum B { b1 = 0x80000000 };
17 enum C { c1 = -1, c2 = 0x80000000 };
18 enum D { d1 = CHAR_MIN, d2 = CHAR_MAX };
19 enum E { e1 = CHAR_MIN, e2 = CHAR_MIN };
21 main()
23   return (sizeof (A) != 4 || sizeof (B) != 4 || sizeof (C) != 8
24           || sizeof (D) != 1 || sizeof (E) != 1);