summaryrefslogtreecommitdiff
path: root/fpcsrc/tests/test/cg/variants/ivarol123.pp
blob: df265dd1b456019947ea6223514885bf1a2d9509 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
{$ifndef bigfile}
{$ifdef fpc}
{$mode delphi}
{$else fpc}
{$define FPC_HAS_TYPE_EXTENDED}
{$endif fpc}
{$endif bigfile}

type 
{$ifdef FPC_COMP_IS_INT64}
  comp123 = double;
{$else FPC_COMP_IS_INT64}
  comp123 = comp;
{$endif FPC_COMP_IS_INT64}
procedure test123(a: byte); overload;
  begin
    writeln('byte called instead of char');
  end;

procedure test123(a: char); overload;
  begin
    writeln('char called instead of byte');
    halt(1)
  end;

var
  x123: byte;

  y123: char;
procedure dotest123;
var
  v: variant;

begin
  try
    v := x123;
    test123(v);
  except
    on E : TObject do
      halt(1);
  end;

  try
    v := y123;
    test123(v);
  except
    on E : TObject do
      writeln('VVV');
  end;
end;

{$ifndef bigfile} begin
  dotest123;
end. {$endif not bigfile}