One way to do what you want is to change the parameter to an open array of TTest, i.e.
procedure DoTest(const stest: array of TTest);
But supposed you don't want to change the parameter, and really want it to be a TArray<TTest>, then you can simply use the array pseudo-constructor syntax to call it (in almost all versions of Delphi, except the very old ones). Say you have something like:
type
TTest = (a, b, c);
procedure DoTest(const stest: TArray<TTest>);
// simple demo implementation
var
I: Integer;
begin
for I := Low(stest) to High(stest) do
Write(Integer(stest[I]), ' ');
Writeln;
end;
Then it can be called, using the Create syntax without having to declare a variable or having to fill it manually. The compiler will do this for you:
begin
DoTest(TArray<TTest>.Create(a, c, b, a, c));
end.
The output is, as expected:
0 2 1 0 2
TArray<Ttest>is not an open array parameter -array of Ttestwould be.TArray<TTest>. How can I call it without passing aTArray<TTest>?" Surely it's obvious that you cannot do that. Change the function to accept an open array parameter.