Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Strange bug with anonymous methods in 'initialization' section

This unit fails to compile in XE2 Update 3 with error "Internal Error: SY6315". In XE there is no such problem.

unit Test;

interface

uses
  SysUtils;

var
  Proc: TProc;

implementation

initialization
   Proc := procedure
    var ByteArr: array of Byte;
    begin
      SetLength(ByteArr, 10);
    end;

end.

Does anyone have any experience of this problem?

Update: I have submitted a QC report: QC#102888.

like image 973
BofA Avatar asked Jan 25 '12 15:01

BofA


1 Answers

Looks like a compiler bug, this is a workaround using TBytes

   Proc := procedure
    var
     ByteArr: TBytes;
    begin
      SetLength(ByteArr, 10);
    end;
like image 191
RRUZ Avatar answered Nov 15 '22 10:11

RRUZ