1
0
mirror of https://github.com/golang/go synced 2024-11-21 13:54:43 -07:00

gc: another pointer to interface message

R=ken2
CC=golang-dev
https://golang.org/cl/4444056
This commit is contained in:
Russ Cox 2011-04-21 08:20:29 -04:00
parent 5ff3336490
commit f10a7882c6
2 changed files with 8 additions and 6 deletions

View File

@ -1928,13 +1928,14 @@ assignop(Type *src, Type *dst, char **why)
}
return 0;
}
if(isptrto(dst, TINTER)) {
if(why != nil)
*why = smprint(":\n\t%T is pointer to interface, not interface", dst);
return 0;
}
if(src->etype == TINTER && dst->etype != TBLANK) {
if(why != nil) {
if(isptrto(dst, TINTER))
*why = smprint(":\n\t%T is interface, not pointer to interface", src);
else
*why = ": need type assertion";
}
if(why != nil)
*why = ": need type assertion";
return 0;
}

View File

@ -33,4 +33,5 @@ func main() {
print("call addinst\n")
var x Inst = AddInst(new(Start)) // ERROR "pointer to interface"
print("return from addinst\n")
var x *Inst = new(Start) // ERROR "pointer to interface"
}