1
0
mirror of https://github.com/golang/go synced 2024-11-22 11:24:49 -07:00
R=ken
OCL=33792
CL=33803
This commit is contained in:
Russ Cox 2009-08-24 17:06:10 -07:00
parent 92543daff1
commit d66d65da96
3 changed files with 13 additions and 7 deletions

View File

@ -752,12 +752,13 @@ ok:
Type** Type**
stotype(NodeList *l, int et, Type **t) stotype(NodeList *l, int et, Type **t)
{ {
Type *f, *t1; Type *f, *t1, **t0;
Strlit *note; Strlit *note;
int lno; int lno;
NodeList *init; NodeList *init;
Node *n; Node *n;
t0 = t;
init = nil; init = nil;
lno = lineno; lno = lineno;
for(; l; l=l->next) { for(; l; l=l->next) {
@ -837,6 +838,14 @@ stotype(NodeList *l, int et, Type **t)
f->sym = f->nname->sym; f->sym = f->nname->sym;
if(pkgimportname != S && !exportname(f->sym->name)) if(pkgimportname != S && !exportname(f->sym->name))
f->sym = pkglookup(f->sym->name, structpkg); 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; *t = f;

View File

@ -1,4 +1,4 @@
// ! $G $D/$F.go || echo BUG: compilation succeeds incorrectly // errchk $G $D/$F.go
// Copyright 2009 The Go Authors. All rights reserved. // Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
@ -7,7 +7,7 @@
package main package main
type T struct { type T struct {
x, x int // this should be a compile-time error x, x int // ERROR "duplicate"
} }
/* /*

View File

@ -141,9 +141,6 @@ panic PC=xxx
== bugs/ == bugs/
=========== bugs/bug132.go
BUG: compilation succeeds incorrectly
=========== bugs/bug136.go =========== bugs/bug136.go
BUG: errchk: command succeeded unexpectedly BUG: errchk: command succeeded unexpectedly