fpc/tests/test/cg/variants/ivarol142.pp
paul b80e7c8fba compiler: change candidates search preference for variant arguments based on testing delphi XE + fixing tests
before the change order was (from better to worse): shortstring, ansistring, widestring, unicodestring
now the order is (from better to worse): widestring, unicodestring, ansistring, shortstring

git-svn-id: trunk@20907 -
2012-04-18 09:13:24 +00:00

55 lines
834 B
ObjectPascal

{$ifndef bigfile}
{$ifdef fpc}
{$mode delphi}
{$else fpc}
{$define FPC_HAS_TYPE_EXTENDED}
{$endif fpc}
{$endif bigfile}
type
{$ifdef FPC_COMP_IS_INT64}
comp142 = double;
{$else FPC_COMP_IS_INT64}
comp142 = comp;
{$endif FPC_COMP_IS_INT64}
procedure test142(a: shortstring); overload;
begin
writeln('shortstring called instead of widestring');
halt(1)
end;
procedure test142(a: widestring); overload;
begin
writeln('widestring called instead of shortstring');
end;
var
x142: shortstring;
y142: widestring;
procedure dotest142;
var
v: variant;
begin
try
v := x142;
test142(v);
except
on E : TObject do
halt(1);
end;
try
v := y142;
test142(v);
except
on E : TObject do
halt(1);
end;
end;
{$ifndef bigfile} begin
dotest142;
end. {$endif not bigfile}