From ff6e310b007a9a2addbef70607dfb662c9673d2d Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Mon, 18 Jan 2010 17:30:15 -0800 Subject: [PATCH] gc: bug245 Fixes #529. R=ken2 CC=golang-dev https://golang.org/cl/186215 --- src/cmd/gc/sinit.c | 2 ++ src/cmd/gc/typecheck.c | 2 +- test/fixedbugs/bug245.go | 16 ++++++++++++++++ 3 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 test/fixedbugs/bug245.go diff --git a/src/cmd/gc/sinit.c b/src/cmd/gc/sinit.c index 1b618fddb2a..fd73dc0ad17 100644 --- a/src/cmd/gc/sinit.c +++ b/src/cmd/gc/sinit.c @@ -322,6 +322,7 @@ slicelit(Node *n, Node *var, NodeList **init) t = shallow(n->type); t->bound = mpgetfix(n->right->val.u.xval); t->width = 0; + t->sym = nil; dowidth(t); // make static initialized array @@ -688,6 +689,7 @@ initctxt: t = shallow(t); t->bound = mpgetfix(n->right->right->val.u.xval); t->width = 0; + t->sym = nil; dowidth(t); // make static initialized array diff --git a/src/cmd/gc/typecheck.c b/src/cmd/gc/typecheck.c index 0c18097dac5..f0866ae3bb0 100644 --- a/src/cmd/gc/typecheck.c +++ b/src/cmd/gc/typecheck.c @@ -1715,7 +1715,7 @@ typecheckcomplit(Node **np) memset(hash, 0, sizeof hash); - l = typecheck(&n->right /* sic */, Etype /* TODO | Edotarray */); + l = typecheck(&n->right /* sic */, Etype); if((t = l->type) == T) goto error; nerr = nerrors; diff --git a/test/fixedbugs/bug245.go b/test/fixedbugs/bug245.go new file mode 100644 index 00000000000..6e5a8b344f7 --- /dev/null +++ b/test/fixedbugs/bug245.go @@ -0,0 +1,16 @@ +// $G $D/$F.go || echo BUG: bug245 + +// Copyright 2010 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package main + +type T []int +func (t T) m() + +func main() { + _ = T{} +} + +// bug245.go:14: fatal error: method mismatch: T for T