summaryrefslogtreecommitdiff
path: root/fpcsrc/tests/webtbs/tw4006.pp
blob: cf7c331318cb243e69b674d04c5a2e6dab07f8e1 (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
55
56
57
58
59
60
61
{ %opt=-Sew -vw }

{ Source provided for Free Pascal Bug Report 4006 }
{ Submitted by "Torsten Kildal" on  2005-05-23 }
{ e-mail: kildal@mx }
program Val_Test;
{$IFDEF FPC}
  {$MODE TP}  {BP/TP compatible}
  {$H-}       {short strings!}
{$ENDIF}

{$R+}

VAR
  s     : string;
  iVar  : smallint;
  lVar  : longint;             { BP7  = Borland Pascal }
  rVar  : real;                { 1010 = FPC 1.0.10     }
  iCode : integer;             { 196  = FPC 1.9.6      }
  wCode : word;                { 200  = FPC 2.0.0      }

begin
  s:='3.14'; {content plays no roll}

  VAL(s,iVar,iCode);
  {BP7 : ok}
  {1010: ok}
  {196 : Warning: Type size mismatch, possible loss of data / range check error}
  {200 : Warning: Type size mismatch, possible loss of data / range check error}

  VAL(s,lVar,iCode);
  {BP7 : ok}
  {1010: ok}
  {196 : ok}
  {200 : ok}

  VAL(s,rVar,iCode);
  {BP7 : ok}
  {1010: ok}
  {196 : Warning: Type size mismatch, possible loss of data / range check error}
  {200 : Warning: Type size mismatch, possible loss of data / range check error}
(*
  VAL(s,iVar,wCode);
  {BP7 : ok}
  {1010: ok}
  {196 : Warning: Type size mismatch, possible loss of data / range check error}
  {200 : Warning: Type size mismatch, possible loss of data / range check error}

  VAL(s,lVar,wCode);
  {BP7 : ok}
  {1010: ok}
  {196 : ok}
  {200 : ok}

  VAL(s,rVar,wCode);
  {BP7 : ok}
  {1010: ok}
  {196 : Warning: Type size mismatch, possible loss of data / range check error}
  {200 : Warning: Type size mismatch, possible loss of data / range check error}
*)
end.