Unclear compiler error for generic array initialization.
Original Reporter info from Mantis: hnb
-
Reporter name: Maciej Izak
Original Reporter info from Mantis: hnb
- Reporter name: Maciej Izak
Description:
Initializing arrays of this type should be locked, with clear message. Now the compiler contradicts itself.
---program---
{$MODE DELPHI}
type
TA = class
const C = 1;
end;
TB<T> = object
procedure Foo;
end;
procedure TB<T>.Foo;
var
// X: array[0..T.C] of byte = (0); // Error: Expected another 1 array elements
X: array[0..T.C] of byte = (0, 2); // Fatal: Syntax error, ")" expected but "," found
begin
end;
var
x: TB<TA>;
begin
end.
Mantis conversion info:
- Mantis ID: 25602
- Version: 2.7.1
- Fixed in version: 3.1.1
- Fixed in revision: 29598 (#461821d1)