1
0
mirror of https://github.com/golang/go synced 2024-09-25 15:20:13 -06:00

conversion to/from

any pointer or uintptr
and unsafe.pointer

R=r
OCL=20795
CL=20795
This commit is contained in:
Ken Thompson 2008-12-08 20:50:17 -08:00
parent 1d4daa2d39
commit bf6164719a

View 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;