From 5406f5b7465451bf862662a8883a5ea0f2da7a5c Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Thu, 7 Jan 2010 23:20:00 -0800 Subject: gc: bug241 Fixes issue 495. R=ken2 CC=golang-dev http://codereview.appspot.com/183156 --- src/cmd/gc/typecheck.c | 4 +++- test/fixedbugs/bug241.go | 11 +++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 test/fixedbugs/bug241.go 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" + -- cgit v1.2.3