diff options
author | Ken Thompson <ken@golang.org> | 2008-12-08 20:50:17 -0800 |
---|---|---|
committer | Ken Thompson <ken@golang.org> | 2008-12-08 20:50:17 -0800 |
commit | 0be8eba9baee68be05594c502ea00ac3fb4dba76 (patch) | |
tree | c550445e1d29146c713ea024ed7eeb84c852fec3 /src | |
parent | 99433fd322024e2cebfa9b460dd34178ae5eee92 (diff) | |
download | golang-0be8eba9baee68be05594c502ea00ac3fb4dba76.tar.gz |
conversion to/from
any pointer or uintptr
and unsafe.pointer
R=r
OCL=20795
CL=20795
Diffstat (limited to 'src')
-rw-r--r-- | src/cmd/gc/walk.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/cmd/gc/walk.c b/src/cmd/gc/walk.c index 067aed49d..37a690302 100644 --- a/src/cmd/gc/walk.c +++ b/src/cmd/gc/walk.c @@ -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; |