-gt tries to modify a constant value when a function has a constant return value set by Default() of a record type
Original Reporter info from Mantis: Hixie
-
Reporter name: Ian Hickson
Original Reporter info from Mantis: Hixie
- Reporter name: Ian Hickson
Description:
The following program, when compiled with -gt, fails to compile, with "Error: Can't assign values to const variable". From what I can tell it's because -gt is trying to trash the Result variable, and the Default() when applied to a record is somehow messing that up.
{$MODE OBJFPC}
program test;
type
TRecord = record
Member: Pointer;
end;
function TestFunction(): TRecord;
begin // test.pas(10,1) Error: Can't assign values to const variable
Result := Default(TRecord);
end;
begin
end.
Mantis conversion info:
- Mantis ID: 26271
- Build: trunk from 2014/03/18
- Platform: x86_64
- Version: 2.7.1
- Fixed in version: 3.0.0
- Fixed in revision: 27872 (#4a0d27eb)