소스 검색

*bugs 246-251

pierre 26 년 전
부모
커밋
5f505feef3
6개의 변경된 파일157개의 추가작업 그리고 0개의 파일을 삭제
  1. 13 0
      tests/tbf0246.pp
  2. 8 0
      tests/tbf0248.pp
  3. 22 0
      tests/tbs0247.pp
  4. 59 0
      tests/tbs0249.pp
  5. 29 0
      tests/tbs0250.pp
  6. 26 0
      tests/tbs0251.pp

+ 13 - 0
tests/tbf0246.pp

@@ -0,0 +1,13 @@
+type
+  tref=record
+    ofs : longint;
+  end;
+
+procedure p(const ref:tref);
+begin
+  with ref do
+   ofs:=ofs+1;   { This should issue an error, because ref is const ! }
+end;
+
+begin
+end.

+ 8 - 0
tests/tbf0248.pp

@@ -0,0 +1,8 @@
+{$asmmode att}
+
+begin
+  asm
+     call *%eax // this is correct
+     movl %esi,*%eax
+  end;
+end.

+ 22 - 0
tests/tbs0247.pp

@@ -0,0 +1,22 @@
+{$mode delphi}
+
+var 
+ x : integer = 34;
+{ this is the way Delphi creates initialized vars
+  ++ its much more logical then BP 
+  typed const !! 
+  -- its incompatible with BP !! (PM) }
+
+ y : array[0..2] of real = (0.0,1.23,2.56);
+
+{ these are true const in Delphi mode and thus 
+  it should not be possible to change ! }
+
+const
+ z : real = 45.2;
+
+begin
+ y[2]:=z;
+ { this should be refused ! }
+ z:=y[1];
+end.

+ 59 - 0
tests/tbs0249.pp

@@ -0,0 +1,59 @@
+program TestEvent;
+
+{$M+}
+
+type
+  TNotifyEvent = procedure( Sender: TObject ) of object;
+
+  THost = class
+    FOnEvent: TNotifyEvent;
+    procedure SetOnEvent( Value: TNotifyEvent );
+  public
+    constructor Create;
+    procedure Trigger;
+    procedure SayHello;
+  published
+    property OnEvent: TNotifyEvent read FOnEvent write SetOnEvent;
+  end;
+
+  TDummy = class
+    procedure HandleEvent( Sender: TObject );
+  end;
+
+constructor THost.Create;
+begin
+  FOnEvent := nil;
+end;
+
+procedure THost.Trigger;
+begin
+  if @FOnEvent <> nil then
+    FOnEvent( Self )
+end;
+
+procedure THost.SetOnEvent( Value: TNotifyEvent );
+begin
+  FOnEvent := Value             
+end;
+
+procedure THost.SayHello;
+begin
+  Writeln( 'Hello event' )
+end;
+
+procedure TDummy.HandleEvent( Sender: TObject );
+begin
+  THost( Sender ).SayHello
+end;
+
+
+var
+  Host: THost;
+  Dummy: TDummy;
+begin
+  Dummy := TDummy.Create;
+  Host := THost.Create;
+  with Host,Dummy do
+    OnEvent := HandleEvent; // this is 57, 27 is ";"
+  Host.Trigger;
+end.

+ 29 - 0
tests/tbs0250.pp

@@ -0,0 +1,29 @@
+program testme;
+
+uses erroru;
+
+// Removing this switch removes the bug !!
+{$H+}
+
+var A : String;
+    P : PChar;
+    I : longint;
+    
+begin
+  P := 'Some sample testchar';
+  A := Ansistring(P);
+  Writeln ('A : ',A);
+  for I:=1 to length(A)-1 do
+    begin
+    A:='Some small test';
+    A:=A+' ansistring';
+    Writeln ('A : ',A);
+    If A<>'' then 
+      Writeln ('All is fine')
+    else
+      begin
+         writeln ('Oh-oh!');
+         error;
+      end;
+    end;
+end.

+ 26 - 0
tests/tbs0251.pp

@@ -0,0 +1,26 @@
+
+uses erroru;
+
+const
+  c : byte = 5;
+  r : real = 3.4;
+var
+  l : longint;
+  cc : char;
+  rr : real;
+
+begin
+  l:=longint(@r);
+  if (l mod 4)<>0 then
+    begin
+       Writeln('static const are not aligned properly !');
+       error;
+    end;
+  cc:='d';
+  l:=longint(@rr);
+  if (l mod 4)<>0 then
+    begin
+       Writeln('static var are not aligned properly !');
+       error;
+    end;
+end.