diff options
author | upstream source tree <ports@midipix.org> | 2015-03-15 20:14:05 -0400 |
---|---|---|
committer | upstream source tree <ports@midipix.org> | 2015-03-15 20:14:05 -0400 |
commit | 554fd8c5195424bdbcabf5de30fdc183aba391bd (patch) | |
tree | 976dc5ab7fddf506dadce60ae936f43f58787092 /gcc/testsuite/gcc.dg/anon-struct-9.c | |
download | cbb-gcc-4.6.4-15d2061ac0796199866debe9ac87130894b0cdd3.tar.bz2 cbb-gcc-4.6.4-15d2061ac0796199866debe9ac87130894b0cdd3.tar.xz |
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
verified gcc-4.6.4.tar.bz2.sig;
imported gcc-4.6.4 source tree from verified upstream tarball.
downloading a git-generated archive based on the 'upstream' tag
should provide you with a source tree that is binary identical
to the one extracted from the above tarball.
if you have obtained the source via the command 'git clone',
however, do note that line-endings of files in your working
directory might differ from line-endings of the respective
files in the upstream repository.
Diffstat (limited to 'gcc/testsuite/gcc.dg/anon-struct-9.c')
-rw-r--r-- | gcc/testsuite/gcc.dg/anon-struct-9.c | 129 |
1 files changed, 129 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/anon-struct-9.c b/gcc/testsuite/gcc.dg/anon-struct-9.c new file mode 100644 index 000000000..d22349045 --- /dev/null +++ b/gcc/testsuite/gcc.dg/anon-struct-9.c @@ -0,0 +1,129 @@ +/* Test for diagnostics for duplicate member names in anonymous + structures and unions. PR 4784. */ +/* { dg-do compile } */ +/* { dg-options "" } */ + +struct s1 +{ + int x; + struct + { + int x; /* { dg-error "duplicate member" } */ + }; +}; + +struct s2 +{ + struct + { + int a; + struct + { + int b; + }; + }; + struct + { + int b; /* { dg-error "duplicate member" } */ + }; +}; + +struct s3 +{ + struct + { + int a; + struct + { + int b; + }; + }; + struct + { + int b; /* { dg-error "duplicate member" } */ + int c; + }; +}; + +struct s4 +{ + int x; + struct + { + int x; + } y; +}; + +union u1 +{ + int x; + union + { + int x; /* { dg-error "duplicate member" } */ + }; +}; + +union u2 +{ + union + { + int a; + union + { + int b; + }; + }; + union + { + int b; /* { dg-error "duplicate member" } */ + }; +}; + +union u3 +{ + union + { + int a; + union + { + int b; + }; + }; + union + { + int b; /* { dg-error "duplicate member" } */ + int c; + }; +}; + +union u4 +{ + int x; + union + { + int x; + } y; +}; + +#define D10(x) int x##0; int x##1; int x##2; int x##3; int x##4; int x##5; int x##6; int x##7; int x##8; int x##9; +#define D100(x) D10(x##0) D10(x##1) D10(x##2) D10(x##3) D10(x##4) D10(x##5) D10(x##6) D10(x##7) D10(x##8) D10(x##9) + +#define S10(x) struct { D100(x##0) }; struct { D100(x##1) }; struct { D100(x##2) }; struct { D100(x##3) }; struct { D100(x##4) }; struct { D100(x##5) }; struct { D100(x##6) }; struct { D100(x##7) }; struct { D100(x##8) }; struct { D100(x##9) }; + +struct sbig +{ + S10(a) + S10(b) + S10(c) + S10(d) + S10(e) + S10(f) + S10(g) + S10(h) + S10(j) + S10(k) + struct + { + int a123; /* { dg-error "duplicate member" } */ + }; +}; |