[fpc-pascal] Dynamic array bug

Ryan Joseph ryan at thealchemistguild.com
Wed Nov 7 05:12:49 CET 2018


I finally built the trunk today (version 3.3.1) to try new dynamic array features and a bug fix Sven did a while ago but I’m still getting errors.

Did I get the wrong version or something? I thought these things were working now.

{$mode objfpc}
{$modeswitch advancedrecords}

program general;

type
	TIntArray = array of integer;
	TMyRec = record
		a: TIntArray;
		class operator := (right:TIntArray):TMyRec;
	end;

class operator TMyRec.:= (right:TIntArray):TMyRec;
begin
	result.a := right;
end;

var
	r: TMyRec;
	a: TIntArray;
begin
	r := [1, 2, 3]; // Incompatible types: got "Set Of Byte" expected "TMyRec"
	a := [1, 2, 3];
	a := a + [4]; 	// Operator is not overloaded: "{Dynamic} Array Of LongInt" + "Set Of Byte"
end.

Regards,
	Ryan Joseph




More information about the fpc-pascal mailing list