diff options
author | Russ Cox <rsc@golang.org> | 2010-01-07 23:20:00 -0800 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2010-01-07 23:20:00 -0800 |
commit | 5406f5b7465451bf862662a8883a5ea0f2da7a5c (patch) | |
tree | 10767d8e60463705e1fba51526e603793fc2211a | |
parent | 741ee78daec057dfe1499eb1b9bd2e9ed481f3bb (diff) | |
download | golang-5406f5b7465451bf862662a8883a5ea0f2da7a5c.tar.gz |
gc: bug241
Fixes issue 495.
R=ken2
CC=golang-dev
http://codereview.appspot.com/183156
-rw-r--r-- | src/cmd/gc/typecheck.c | 4 | ||||
-rw-r--r-- | test/fixedbugs/bug241.go | 11 |
2 files changed, 14 insertions, 1 deletions
diff --git a/src/cmd/gc/typecheck.c b/src/cmd/gc/typecheck.c index 08c47d07f..c63480faa 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 000000000..172b3742e --- /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" + |