summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2009-08-24 17:06:10 -0700
committerRuss Cox <rsc@golang.org>2009-08-24 17:06:10 -0700
commit86908a0f4c77108949df3f096c1523f307b16542 (patch)
treea5589c05800fc1918b746e2b5ff8ed08a266a435 /src
parent364f51c923db9995c82a569c87852223d0602ede (diff)
downloadgolang-86908a0f4c77108949df3f096c1523f307b16542.tar.gz
bug132
R=ken OCL=33792 CL=33803
Diffstat (limited to 'src')
-rw-r--r--src/cmd/gc/dcl.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/cmd/gc/dcl.c b/src/cmd/gc/dcl.c
index 559cd8d0a..96a87eeff 100644
--- a/src/cmd/gc/dcl.c
+++ b/src/cmd/gc/dcl.c
@@ -752,12 +752,13 @@ ok:
Type**
stotype(NodeList *l, int et, Type **t)
{
- Type *f, *t1;
+ Type *f, *t1, **t0;
Strlit *note;
int lno;
NodeList *init;
Node *n;
+ t0 = t;
init = nil;
lno = lineno;
for(; l; l=l->next) {
@@ -837,6 +838,14 @@ stotype(NodeList *l, int et, Type **t)
f->sym = f->nname->sym;
if(pkgimportname != S && !exportname(f->sym->name))
f->sym = pkglookup(f->sym->name, structpkg);
+ if(f->sym) {
+ for(t1=*t0; t1!=T; t1=t1->down) {
+ if(t1->sym == f->sym) {
+ yyerror("duplicate field %s", t1->sym->name);
+ break;
+ }
+ }
+ }
}
*t = f;