0
1
mirror of https://github.com/golang/go synced 2025-06-18 18:08:01 +00:00

cmd/gc: fix confusing error when using variable as type.

Fixes .

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6737053
This commit is contained in:
Daniel Morsing
2012-10-21 20:50:31 +02:00
parent a7a3fe7238
commit d7a3407e3d
2 changed files with 13 additions and 1 deletions
src/cmd/gc
test/fixedbugs

@ -476,7 +476,7 @@ reswitch:
n->left = N;
goto ret;
}
if(!isptr[t->etype]) {
if((top & Erv) && !isptr[t->etype]) {
yyerror("invalid indirect of %lN", n->left);
goto error;
}

@ -0,0 +1,12 @@
// errorcheck
// Copyright 2012 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 foo
var i int
func (*i) bar() // ERROR "not a type"