Node *n, *l, *r;
NodeList *args;
int lno, ok, ntop;
- Type *t, *missing, *have;
+ Type *t, *tp, *missing, *have;
Sym *sym;
Val v;
char *why;
ok = Erv;
goto ret;
}
+ tp = t;
if(isptr[t->etype] && t->type->etype != TINTER) {
t = t->type;
if(t == T)
if(lookdot(n, t, 1))
yyerror("%#N undefined (cannot refer to unexported field or method %S)", n, n->right->sym);
else
- yyerror("%#N undefined (type %T has no field or method %S)", n, t, n->right->sym);
+ yyerror("%#N undefined (type %T has no field or method %S)", n, tp, n->right->sym);
goto error;
}
switch(n->op) {
--- /dev/null
+// errchk $G $D/$F.go
+
+// Copyright 2011 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
+
+type T struct{}
+type P *T
+
+func (t *T) Meth() {}
+func (t T) Meth2() {}
+
+func main() {
+ t := &T{}
+ p := P(t)
+ p.Meth() // ERROR "undefined \(type P"
+ p.Meth2() // ERROR "undefined \(type P"
+}
\ No newline at end of file