From: Russ Cox Date: Fri, 8 Jan 2010 07:20:00 +0000 (-0800) Subject: gc: bug241 X-Git-Tag: weekly.2010-01-13~44 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=c6f4d68667ba09e88f124353c6d79812299c5e82;p=gostls13.git gc: bug241 Fixes #495. R=ken2 CC=golang-dev https://golang.org/cl/183156 --- diff --git a/src/cmd/gc/typecheck.c b/src/cmd/gc/typecheck.c index 08c47d07f8..c63480faa2 100644 --- a/src/cmd/gc/typecheck.c +++ b/src/cmd/gc/typecheck.c @@ -446,7 +446,9 @@ reswitch: n->op = ODOT; // fall through case ODOT: - l = typecheck(&n->left, Erv|Etype); + typecheck(&n->left, Erv|Etype); + defaultlit(&n->left, T); + l = n->left; if((t = l->type) == T) goto error; if(n->right->op != ONAME) { diff --git a/test/fixedbugs/bug241.go b/test/fixedbugs/bug241.go new file mode 100644 index 0000000000..172b3742e5 --- /dev/null +++ b/test/fixedbugs/bug241.go @@ -0,0 +1,11 @@ +// errchk $G $D/$F.go + +// 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 + +const c = 3 +var x = c.String() // ERROR "String" +