FAQ
Reviewers: golang-dev_googlegroups.com,

Message:
Hello golang-dev@googlegroups.com (cc: golang-dev@googlegroups.com),

I'd like you to review this change to
https://code.google.com/p/go/


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

Fixes issue 3783.

Please review this at http://codereview.appspot.com/6737053/

Affected files:
M src/cmd/gc/typecheck.c
A test/fixedbugs/issue3783.go


Index: src/cmd/gc/typecheck.c
===================================================================
--- a/src/cmd/gc/typecheck.c
+++ b/src/cmd/gc/typecheck.c
@@ -476,7 +476,7 @@
n->left = N;
goto ret;
}
- if(!isptr[t->etype]) {
+ if((top & Erv) && !isptr[t->etype]) {
yyerror("invalid indirect of %lN", n->left);
goto error;
}
Index: test/fixedbugs/issue3783.go
===================================================================
new file mode 100644
--- /dev/null
+++ b/test/fixedbugs/issue3783.go
@@ -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"
+

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-dev @
categoriesgo
postedOct 21, '12 at 5:58p
activeOct 21, '12 at 6:58p
posts4
users2
websitegolang.org

2 users in discussion

Daniel Morsing: 3 posts Russ Cox: 1 post

People

Translate

site design / logo © 2022 Grokbase