]> Cypherpunks repositories - gostls13.git/commitdiff
conversion to/from
authorKen Thompson <ken@golang.org>
Tue, 9 Dec 2008 04:50:17 +0000 (20:50 -0800)
committerKen Thompson <ken@golang.org>
Tue, 9 Dec 2008 04:50:17 +0000 (20:50 -0800)
any pointer or uintptr
and unsafe.pointer

R=r
OCL=20795
CL=20795

src/cmd/gc/walk.c

index 067aed49d4847654fbe2c35d3662dc73bcfd10ff..37a690302a92a4e5ff796a58f7b97996f361c9b5 100644 (file)
@@ -622,6 +622,22 @@ loop:
                        goto ret;
                }
 
+               // convert to unsafe.pointer
+               if(isptrto(n->type, TANY)) {
+                       if(isptr[l->type->etype])
+                               goto ret;
+                       if(l->type->etype == TUINTPTR)
+                               goto ret;
+               }
+
+               // convert from unsafe.pointer
+               if(isptrto(l->type, TANY)) {
+                       if(isptr[n->type->etype])
+                               goto ret;
+                       if(n->type->etype == TUINTPTR)
+                               goto ret;
+               }
+
                if(l->type != T)
                        yyerror("cannot convert %T to %T", l->type, t);
                goto ret;