From: Russ Cox Date: Thu, 7 Apr 2011 22:53:47 +0000 (-0400) Subject: gc: bug327 X-Git-Tag: weekly.2011-04-13~71 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=35c880b1e2c00752cd8961780e4c26ea5b287377;p=gostls13.git gc: bug327 Fixes #1674. R=ken2 CC=golang-dev https://golang.org/cl/4368057 --- diff --git a/src/cmd/gc/subr.c b/src/cmd/gc/subr.c index b4c58d10d7..eb0fc3c624 100644 --- a/src/cmd/gc/subr.c +++ b/src/cmd/gc/subr.c @@ -1889,8 +1889,9 @@ assignop(Type *src, Type *dst, char **why) return OCONVNOP; // 2. src and dst have identical underlying types - // and either src or dst is not a named type. - if(eqtype(src->orig, dst->orig) && (src->sym == S || dst->sym == S)) + // and either src or dst is not a named type or + // both are interface types. + if(eqtype(src->orig, dst->orig) && (src->sym == S || dst->sym == S || src->etype == TINTER)) return OCONVNOP; // 3. dst is an interface type and src implements dst. diff --git a/test/fixedbugs/bug327.go b/test/fixedbugs/bug327.go new file mode 100644 index 0000000000..10f309da4e --- /dev/null +++ b/test/fixedbugs/bug327.go @@ -0,0 +1,18 @@ +// $G $D/$F.go && $L $F.$A && ./$A.out + +// Copyright 2011 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 ( + a interface{} + b interface{} +) + +func main() { + x := a(1) + z := b(x) + _ = z +}