aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexandre Oliva <aoliva@redhat.com>2002-04-26 23:44:46 +0000
committerAlexandre Oliva <aoliva@gcc.gnu.org>2002-04-26 23:44:46 +0000
commit51ccaeb90434ec16fb5756987b2d7381c1477417 (patch)
tree08ed3619764587dade3b7838b0a83549acb384fb
parentb446a5f1693fa10ea19c1731ae30e3f8619d2208 (diff)
downloadgcc-51ccaeb90434ec16fb5756987b2d7381c1477417.zip
gcc-51ccaeb90434ec16fb5756987b2d7381c1477417.tar.gz
gcc-51ccaeb90434ec16fb5756987b2d7381c1477417.tar.bz2
* gcc.dg/enum1.c: New test.
From-SVN: r52815
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/g++.dg/abi/enum1.C2
-rw-r--r--gcc/testsuite/gcc.dg/enum1.c23
3 files changed, 28 insertions, 1 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index ffaf4aa..c7a4bed 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -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
diff --git a/gcc/testsuite/g++.dg/abi/enum1.C b/gcc/testsuite/g++.dg/abi/enum1.C
index 13138bd..32e52fe 100644
--- a/gcc/testsuite/g++.dg/abi/enum1.C
+++ b/gcc/testsuite/g++.dg/abi/enum1.C
@@ -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
index 0000000..0f4587f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/enum1.c
@@ -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);
+}