]> Cypherpunks repositories - gostls13.git/commitdiff
gc: another pointer to interface message
authorRuss Cox <rsc@golang.org>
Thu, 21 Apr 2011 12:20:29 +0000 (08:20 -0400)
committerRuss Cox <rsc@golang.org>
Thu, 21 Apr 2011 12:20:29 +0000 (08:20 -0400)
R=ken2
CC=golang-dev
https://golang.org/cl/4444056

src/cmd/gc/subr.c
test/interface/pointer.go

index b233a0d8e5dff46a4e23c85bb3550ce524d3c1dc..884bb439d8598a4705f459b25f7f91fda9f4f048 100644 (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;
        }
 
index e628b558eaa70b9b2ed60af0adf551ab1a4d7df2..076469c8dee2a63167de2fc7c4617d0892f8b71f 100644 (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"
 }