On Wed, Nov 7, 2018 at 11:06 PM Ryan Joseph <r...@thealchemistguild.com>
wrote:

> I read the old thread and we need to add {$modeswitch arrayoperators} to
> make it work. a += [4] does work now.
>
> Also I found the thread where Sven said he fixed the "Incompatible types:
> got "Set Of Byte” bug in r39554 (
> https://bugs.freepascal.org/view.php?id=34021). It is indeed fixed but
> only for + operators.
>
> Do you want me to file a new bug report for := operators?


You can temporary solve it by specializing a generic array:

program project1;

{$mode objfpc}{$H+}
{$modeswitch advancedrecords}
{$modeswitch arrayoperators}

uses sysutils;

type
  TIntArray = specialize TArray<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 := specialize TArray<integer>.Create(1, 2, 3);
  a := [1, 2, 3];
  a += [4];
end.

-- 
Silvio Clécio
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to