Skip to content

Commit

Permalink
- Readonly pointer casting now works in ZScript.
Browse files Browse the repository at this point in the history
  • Loading branch information
Player701 authored and coelckers committed Nov 15, 2018
1 parent feef0d4 commit c569029
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions src/scripting/backend/codegen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4691,14 +4691,7 @@ FxExpression *FxDynamicCast::Resolve(FCompileContext& ctx)
{
CHECKRESOLVED();
SAFE_RESOLVE(expr, ctx);
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;
}
bool constflag = expr->ValueType->isPointer() && expr->ValueType->toPointer()->IsConst;
expr = new FxTypeCast(expr, NewPointer(RUNTIME_CLASS(DObject), constflag), true, true);
expr = expr->Resolve(ctx);
if (expr == nullptr)
Expand Down

0 comments on commit c569029

Please sign in to comment.