Fixed a problem with explicit pointer/pointer casts not being allowed.

git-svn-id: http://picoc.googlecode.com/svn/trunk@558 21eae674-98b7-11dd-bd71-f92a316d2d60
This commit is contained in:
zik.saleeba 2011-02-21 00:57:06 +00:00
parent ae653d4810
commit b1bd91a900

View file

@ -347,6 +347,11 @@ void ExpressionAssignToPointer(struct ParseState *Parser, struct Value *ToValue,
/* assign integer to native pointer */
ToValue->Val->Pointer = (void *)(unsigned long)ExpressionCoerceUnsignedInteger(FromValue);
}
else if (AllowPointerCoercion && FromValue->Typ->Base == TypePointer)
{
/* assign a pointer to a pointer to a different type */
ToValue->Val->Pointer = FromValue->Val->Pointer;
}
else
AssignFail(Parser, "%t from %t", ToValue->Typ, FromValue->Typ, 0, 0, FuncName, ParamNo);
}