From: Russ Cox Date: Wed, 25 Nov 2009 00:11:48 +0000 (-0800) Subject: gc: correct type check for x, ok map assignment X-Git-Tag: weekly.2009-12-07~128 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=b7c4314ecb87ee18d6dd8bc12f75bc1716f5ce88;p=gostls13.git gc: correct type check for x, ok map assignment Fixes #288. R=ken2 https://golang.org/cl/157162 --- diff --git a/src/cmd/gc/typecheck.c b/src/cmd/gc/typecheck.c index fb96221bd6..0fd359b319 100644 --- a/src/cmd/gc/typecheck.c +++ b/src/cmd/gc/typecheck.c @@ -2018,7 +2018,7 @@ typecheckas2(Node *n) if(l->type == T) goto out; n->op = OAS2MAPW; - n->rlist->n = typecheckconv(nil, r, l->type->down, 0, nil); + n->rlist->n = typecheckconv(nil, r, l->type, 0, nil); r = n->rlist->next->n; n->rlist->next->n = typecheckconv(nil, r, types[TBOOL], 0, nil); goto out; diff --git a/test/fixedbugs/bug220.go b/test/fixedbugs/bug220.go new file mode 100644 index 0000000000..3f8aaa4ece --- /dev/null +++ b/test/fixedbugs/bug220.go @@ -0,0 +1,14 @@ +// $G $D/$F.go || echo BUG: bug220 + +// Copyright 2009 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 + +func main() { + m := make(map[int]map[uint]float); + + m[0] = make(map[uint]float), false; // 6g used to reject this + m[1] = nil; +}