Closed SignumTemporis closed 2 years ago
An attempt to cast a pointer on the left side of an assignment causes compilation error.
A workaround is to use a local variable with proper type but it consumes memory.
For FPC -MDelphi v3.2.2 it works as expected.
Mad-Pascal Compiler version 9cc0813 Mad-Assembler version 40bfd80
uses crt; type Box = record x: Byte end; BoxPtr = ^Box; var data: array [0 .. 1] of Byte; procedure DoSomething(p: Pointer); begin BoxPtr(p)^.x := BoxPtr(p)^.x + 1; end; begin data[0] := 10; data[1] := 20; DoSomething(@data); WriteLn(data[0], ' ', data[1]); ReadKey(); end.
11 20
test.pas (11,6) Error: Variable identifier expected
fixed
Works for me now.
Issue description
An attempt to cast a pointer on the left side of an assignment causes compilation error.
A workaround is to use a local variable with proper type but it consumes memory.
For FPC -MDelphi v3.2.2 it works as expected.
Mad-Pascal Compiler version 9cc0813 Mad-Assembler version 40bfd80
Code to reproduce the issue
Output
Expected
Actual