summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/pr17844-1.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.dg/pr17844-1.c')
-rw-r--r--gcc/testsuite/gcc.dg/pr17844-1.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/pr17844-1.c b/gcc/testsuite/gcc.dg/pr17844-1.c
new file mode 100644
index 000000000..d06bbb6d7
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr17844-1.c
@@ -0,0 +1,20 @@
+/* -fshort-enums should affect only the type with which an enum is
+ compatible, not the type of the enumeration constants which should
+ still be int. Bug 17844. */
+/* Origin: Joseph Myers <jsm@polyomino.org.uk> */
+/* { dg-do compile } */
+/* { dg-options "-fshort-enums" } */
+
+enum e { A, B };
+
+enum e ev;
+unsigned char uv;
+enum e *ep = &uv;
+unsigned char *up = &ev;
+
+int i;
+__typeof__(A) te;
+int *ip = &te;
+__typeof__(B) *tep = &i;
+
+int x[((sizeof(A) == sizeof(int)) ? 1 : -1)];