mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-11 23:32:02 +00:00
- Readonly pointer casting now works in ZScript.
This commit is contained in:
parent
feef0d4b62
commit
c569029b1d
1 changed files with 1 additions and 8 deletions
|
@ -4692,13 +4692,6 @@ FxExpression *FxDynamicCast::Resolve(FCompileContext& ctx)
|
||||||
CHECKRESOLVED();
|
CHECKRESOLVED();
|
||||||
SAFE_RESOLVE(expr, ctx);
|
SAFE_RESOLVE(expr, ctx);
|
||||||
bool constflag = expr->ValueType->isPointer() && expr->ValueType->toPointer()->IsConst;
|
bool constflag = expr->ValueType->isPointer() && expr->ValueType->toPointer()->IsConst;
|
||||||
if (constflag)
|
|
||||||
{
|
|
||||||
// readonly pointers are normally only used for class defaults which lack type information to be cast properly, so we have to error out here.
|
|
||||||
ScriptPosition.Message(MSG_ERROR, "Cannot cast a readonly pointer");
|
|
||||||
delete this;
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
expr = new FxTypeCast(expr, NewPointer(RUNTIME_CLASS(DObject), constflag), true, true);
|
expr = new FxTypeCast(expr, NewPointer(RUNTIME_CLASS(DObject), constflag), true, true);
|
||||||
expr = expr->Resolve(ctx);
|
expr = expr->Resolve(ctx);
|
||||||
if (expr == nullptr)
|
if (expr == nullptr)
|
||||||
|
|
Loading…
Reference in a new issue