Browse Source

+ Added bug #187

michael 27 years ago
parent
commit
2fcbb9a87d
2 changed files with 67 additions and 0 deletions
  1. 66 0
      bugs/bug0187.pp
  2. 1 0
      bugs/readme.txt

+ 66 - 0
bugs/bug0187.pp

@@ -0,0 +1,66 @@
+program test;
+
+type
+        Tbaseclass = object
+                constructor     Init;
+                destructor      Done;
+                procedure       Run;                            virtual;
+
+        end;
+        Totherclass = object(Tbaseclass)
+                procedure       Run;                            virtual;
+
+        end;
+
+constructor Tbaseclass.Init;
+
+begin
+  writeln('Init');
+  Run;
+end;
+
+destructor Tbaseclass.Done;
+
+begin
+  writeln('Done');
+end;
+
+procedure Tbaseclass.Run;
+
+begin
+  writeln('Base method');
+end;
+
+
+procedure Totherclass.Run;
+
+begin
+  writeln('Inherited method');
+end;
+
+var     base            : Tbaseclass;
+        other           : Totherclass;
+        asmrec          : Tasmrec;
+        testfield       : longint;
+
+begin
+// Uncommenting here and commenting the init in the WIth solves it.
+//  Base.Init;
+  with base do
+  begin
+    Init;
+    Run;
+    Done;
+  end;
+// Uncommenting here and commenting the init in the WIth solves it.
+//  Other.init;
+  with other do
+  begin
+    Init;
+    Run;
+    Done;
+  end;
+
+{ Calls Tbaseclass.Run when it should call Totherclass.Run }
+
+end.

+ 1 - 0
bugs/readme.txt

@@ -248,3 +248,4 @@ bug0171.pp   missing typecasting in constant expressions
 bug0183.pp   internal error 10
 bug0185.pp   missing range checking for Val and subrange types
 bug0186.pp   Erroneous array syntax is accepted.
+bug0187.pp   constructor in a WIth statement isn't called correct.