aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/pr17188-1.c
diff options
context:
space:
mode:
authorJoseph Myers <jsm@polyomino.org.uk>2004-09-24 18:22:20 +0100
committerJoseph Myers <jsm28@gcc.gnu.org>2004-09-24 18:22:20 +0100
commit085e33aa0ad674c2680e6216b7d84737b935351c (patch)
tree0df83d2241d0c2e8cf4abfc9975db885362bef6d /gcc/testsuite/gcc.dg/pr17188-1.c
parenta2159c4c35aa1759292e9cce4ae97bbf04c5861e (diff)
downloadgcc-085e33aa0ad674c2680e6216b7d84737b935351c.zip
gcc-085e33aa0ad674c2680e6216b7d84737b935351c.tar.gz
gcc-085e33aa0ad674c2680e6216b7d84737b935351c.tar.bz2
re PR c/17188 (struct Foo { } redefinition)
PR c/17188 * c-decl.c (diagnose_mismatched_decls): Check for duplicate declarations of enumerators. (start_struct): Check TYPE_SIZE rather than TYPE_FIELDS to check for redefinition. Check for nested redefinition. (finish_struct): Don't check for nested redefinition. (start_enum): Check for nested redefinition. testsuite: * gcc.dg/nested-redef-1.c, gcc.dg/pr17188-1.c: New tests. * gcc.dg/decl-3.c: Adjust expected message. From-SVN: r88063
Diffstat (limited to 'gcc/testsuite/gcc.dg/pr17188-1.c')
-rw-r--r--gcc/testsuite/gcc.dg/pr17188-1.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/pr17188-1.c b/gcc/testsuite/gcc.dg/pr17188-1.c
new file mode 100644
index 0000000..634e60c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr17188-1.c
@@ -0,0 +1,31 @@
+/* A redefinition of an empty struct should be diagnosed the same as a
+ redefinition of any other tag, but formerly only s2 and s4 were
+ diagnosed. Bug 17188. */
+/* Origin: Joseph Myers <jsm@polyomino.org.uk> */
+/* { dg-do compile } */
+/* { dg-options "" } */
+
+struct s0 { };
+struct s0;
+struct s0 { }; /* { dg-error "error: redefinition of 'struct s0'" } */
+
+struct s1 { };
+struct s1 { }; /* { dg-error "error: redefinition of 'struct s1'" } */
+
+struct s2 { int a : 1; };
+struct s2 { int a : 1; }; /* { dg-error "error: redefinition of 'struct s2'" } */
+
+struct s3 { };
+struct s3 { int a : 1; }; /* { dg-error "error: redefinition of 'struct s3'" } */
+
+struct s4 { int a : 1; };
+struct s4 { }; /* { dg-error "error: redefinition of 'struct s4'" } */
+
+struct s5 { int a : 1; };
+struct s5;
+
+struct s6;
+struct s6 { int a : 1; };
+
+struct s7;
+struct s7 { };