{ %fail }
{$ifdef fpc}
{$mode delphi}
{$endif fpc}

{$ifdef FPC_COMP_IS_INT64}
type 
  comp = double;
{$endif FPC_COMP_IS_INT64}
procedure test(a: longint); overload;
  begin
    writeln('longint called instead of cardinal');
    writeln('XXX')
  end;

procedure test(a: cardinal); overload;
  begin
    writeln('cardinal called instead of longint');
    writeln('YYY')
  end;

var
  v: variant;
  x: longint;
  y: cardinal;

begin
  try
    v := x;
    test(v);
  except
    on E : TObject do
      writeln('QQQ');
  end;

  try
    v := y;
    test(v);
  except
    on E : TObject do
      writeln('VVV');
  end;
end.
