fpc/tests/webtbs/tw30203.pp
svenbarth 04adcf2a12 Fix for Mantis #30179 and #30203.
pexpr.pas:
  * handle_factor_typenode: rework code for records and objects so that Delphi style specializations are handled as well
  * sub_expr.generate_inline_specialization: also do a typecheck pass on pload to be sure that we have a resultdef

+ added tests

git-svn-id: trunk@33876 -
2016-06-01 20:06:40 +00:00

49 lines
951 B
ObjectPascal

{ %NORUN }
program tw30203;
{$MODE DELPHI}
{$POINTERMATH ON}
procedure QuickSort<T>(var A: Array of T; const Index, Count: Integer);
var
I, J: Integer;
Temp, Pivot: T;
begin
if Index < Count then
begin
Pivot := A[Random(Count - Index) + Index + 1];
I := Index - 1;
J := Count + 1;
repeat
repeat Inc(I) until A[I] >= Pivot;
repeat Dec(J) until A[J] <= Pivot;
Temp := A[I];
A[I] := A[J];
A[J] := Temp;
until I >= J;
A[J] := A[I];
A[I] := Temp;
QuickSort<T>(A, Index, I - 1);
QuickSort<T>(A, I, Count);
end;
end;
var
arri: array of LongInt;
arrs: array of String;
begin
SetLength(arri, 4);
arri[0] := 4;
arri[1] := 2;
arri[2] := 6;
arri[3] := 1;
SetLength(arrs, 4);
arrs[0] := 'World';
arrs[1] := 'Alpha';
arrs[2] := 'Hello';
arrs[3] := 'Foo';
QuickSort<LongInt>(arri, Low(arri), High(arri));
QuickSort<String>(arrs, Low(arrs), High(arrs));
end.