Kids, don’t try this at home 🙂
class procedure DynamicArray<T>.Test(); var Arr : array of T; begin { Fails miserably! } end;
Error:
[DCC Fatal Error] Tests.DynamicArray.pas(772): F2084 Internal Error: URW1135
There you have it 🙂
The fix is rather simple but annoying:
Declare a new type in the class/record like this:
type DynamicArray<T> = class private type TArrayOfT = array of T; public { Lots of stuff here } end;
And then simply make the variable Arr to be TArrayOfT:
class procedure DynamicArray<T>.Test(); var Arr : TArrayOfT; begin { Works! } end;
Till the next bug.