From: Ken Thompson Date: Tue, 9 Dec 2008 04:50:17 +0000 (-0800) Subject: conversion to/from X-Git-Tag: weekly.2009-11-06~2552 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=bf6164719a20b5003ed6a4f49fb2d796801240af;p=gostls13.git conversion to/from any pointer or uintptr and unsafe.pointer R=r OCL=20795 CL=20795 --- diff --git a/src/cmd/gc/walk.c b/src/cmd/gc/walk.c index 067aed49d4..37a690302a 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;