[fpc-devel] Passing consts to const

David Butler david at e.co.za
Tue Jun 7 16:14:13 CEST 2005


Hi

The following code snippet gives a compile error: "Error: Can't assign
values to const variable".

It should be legal, since we are passing a const to a const parameter.

It should only give that error if TestBuf was declared as "var Buf"
instead of "const Buf".

Regards
David


{$WRITEABLECONST OFF}

procedure TestBuf(const Buf; Size: Integer);
begin
end;

const A : Byte = 1;

begin
  TestBuf(A, 1);
end.





More information about the fpc-devel mailing list