gc: another pointer to interface message
R=ken2
CC=golang-dev
https://golang.org/cl/4444056
diff --git a/src/cmd/gc/subr.c b/src/cmd/gc/subr.c
index b233a0d..884bb43 100644
--- a/src/cmd/gc/subr.c
+++ b/src/cmd/gc/subr.c
@@ -1928,13 +1928,14 @@
}
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;
}
diff --git a/test/interface/pointer.go b/test/interface/pointer.go
index e628b55..076469c 100644
--- a/test/interface/pointer.go
+++ b/test/interface/pointer.go
@@ -33,4 +33,5 @@
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"
}