* gcc.dg/enum1.c: New test.
authorAlexandre Oliva <aoliva@redhat.com>
Fri, 26 Apr 2002 23:44:46 +0000 (23:44 +0000)
committerAlexandre Oliva <aoliva@gcc.gnu.org>
Fri, 26 Apr 2002 23:44:46 +0000 (23:44 +0000)
From-SVN: r52815

gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/abi/enum1.C
gcc/testsuite/gcc.dg/enum1.c [new file with mode: 0644]

index ffaf4aa2c253964e827f53b2244453db07d99e62..c7a4bed57fb90686f136476543125a530a08ac52 100644 (file)
@@ -1,3 +1,7 @@
+2002-04-26  Alexandre Oliva  <aoliva@redhat.com>
+
+       * gcc.dg/enum1.c: New test.
+
 2002-04-26  Mark Mitchell  <mark@codesourcery.com>
 
        PR c++/6497
index 13138bd645bae7bd84a3f20db96dcb5549cd7ca2..32e52fe0f5e4affa064c54ac225aad79320a918c 100644 (file)
@@ -9,7 +9,7 @@ enum foo
   foo3   = 0xf0fffffffffffffeULL
 };
 
-int main (int i)
+int main ()
 {
   if (sizeof (enum foo) != sizeof (unsigned long long))
     std::abort ();
diff --git a/gcc/testsuite/gcc.dg/enum1.c b/gcc/testsuite/gcc.dg/enum1.c
new file mode 100644 (file)
index 0000000..0f4587f
--- /dev/null
@@ -0,0 +1,23 @@
+/* { dg-do run } */
+/* { dg-options "-std=gnu89" } */
+
+/* In standard C, enumeration constants always have type int.  If they
+   are not representables are int, they're ill-formed.  In GNU C, we
+   give such ill-formed constructs well-defined meaning.  Make sure it
+   works.  */
+
+#include <stdlib.h>
+
+enum foo
+{
+  foo1   = 0,
+  foo2   = 0xffffffffffffffffULL,
+  foo3   = 0xf0fffffffffffffeULL
+};
+
+int main ()
+{
+  if (sizeof (enum foo) != sizeof (unsigned long long))
+    abort ();
+  exit (0);
+}