Error with trash local variables (-gt) + assignment operator
Original Reporter info from Mantis: km
-
Reporter name: Kieran
Original Reporter info from Mantis: km
- Reporter name: Kieran
Description:
* Get 'Error: Argument cannot be assigned to' when a local variable to be trashed has an assignment operator overloaded
* The local variable is small (8 bytes)
* The assignment operator outputs an int64
* An inverse assignment operator (int64 -> type) doesn't cause an error
Steps to reproduce:
Compile sample:
program trashtest;
{$MODE OBJFPC}
type
TTestRec = record
Field1 : Int64;
end;
operator := (i: TTestRec) fR: Int64;
begin
fR := i.Field1;
end;
function TestFunc:TTestRec;
begin //error reported here
TestFunc.Field1 := 1;
end;
begin
WriteLn(TestFunc.Field1);
end.
Mantis conversion info:
- Mantis ID: 28375
- OS: Linux
- Build: 31185
- Platform: x86_64
- Version: 3.1.1
- Fixed in version: 3.1.1
- Fixed in revision: 31191 (#fa1ac251)