summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/anon-struct-14.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.dg/anon-struct-14.c')
-rw-r--r--gcc/testsuite/gcc.dg/anon-struct-14.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/anon-struct-14.c b/gcc/testsuite/gcc.dg/anon-struct-14.c
new file mode 100644
index 000000000..293ccc75a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/anon-struct-14.c
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+/* { dg-options "-fplan9-extensions" } */
+
+/* When using Plan 9 extensions, a typedef can conflict with an
+ anonymous field. */
+
+typedef struct { int a; } s1;
+struct s2 { s1; int s1; }; /* { dg-error "duplicate" } */
+int f(struct s2 *p) { return p->s1; } /* { dg-error "incompatible" } */