aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.dg/c11-anon-struct-3.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.9/gcc/testsuite/gcc.dg/c11-anon-struct-3.c')
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/c11-anon-struct-3.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/c11-anon-struct-3.c b/gcc-4.9/gcc/testsuite/gcc.dg/c11-anon-struct-3.c
new file mode 100644
index 000000000..05cc3660c
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/c11-anon-struct-3.c
@@ -0,0 +1,34 @@
+/* Test for anonymous structures and unions in C11. Test for invalid
+ cases: typedefs disallowed by N1549. */
+/* { dg-do compile } */
+/* { dg-options "-std=c11 -pedantic-errors" } */
+
+typedef struct
+{
+ int i;
+} s0;
+
+typedef union
+{
+ int i;
+} u0;
+
+struct s1
+{
+ int a;
+ u0; /* { dg-error "declaration does not declare anything" } */
+ struct
+ {
+ int b;
+ };
+};
+
+union u1
+{
+ int b;
+ s0; /* { dg-error "declaration does not declare anything" } */
+ union
+ {
+ int c;
+ };
+};