Browse Source

* removed wrong object size checks in static methods

peter 22 years ago
parent
commit
907d811e2e
1 changed files with 0 additions and 104 deletions
  1. 0 104
      tests/test/cg/tobjsize.pp

+ 0 - 104
tests/test/cg/tobjsize.pp

@@ -1,7 +1,3 @@
-
-
-{$static on}
-
 type
    pbaseclass = ^tbaseclass;
    pderivedclass = ^tderivedclass;
@@ -9,19 +5,11 @@ type
    tbaseclass = object
      x : longint;
      constructor init;
-     function getsize : longint; static;
-     function getsize2 : longint;
-     procedure check_size; virtual;
-     procedure static_check_size; static;
-     procedure check_normal;
-     procedure check_static; static;
-     procedure check_virtual; virtual;
      destructor done; virtual;
    end;
 
    tderivedclass = object(tbaseclass)
      y : longint;
-     procedure check_size; virtual;
    end;
 
 const
@@ -41,73 +29,12 @@ destructor tbaseclass.done;
 begin
 end;
 
-function tbaseclass.getsize : longint;
-begin
-  getsize:=sizeof(self);
-end;
-
-function tbaseclass.getsize2 : longint;
-begin
-  getsize2:=sizeof(self);
-end;
-
-procedure tbaseclass.check_size;
-begin
-  if sizeof(self)<>getsize then
-    begin
-      Writeln('Compiler creates garbage');
-      has_error:=true;
-    end;
-  if sizeof(self)<>getsize2 then
-    begin
-      Writeln('Compiler creates garbage');
-      has_error:=true;
-    end;
-end;
-
-procedure tbaseclass.static_check_size;
-begin
-  if sizeof(self)<>getsize then
-    begin
-      Writeln('Compiler creates garbage');
-      has_error:=true;
-    end;
-end;
-
-procedure tbaseclass.check_normal;
-begin
-  check_size;
-  static_check_size;
-end;
-
-procedure tbaseclass.check_static;
-begin
-  {check_size;}
-  static_check_size;
-end;
-
-procedure tbaseclass.check_virtual;
-begin
-  check_size;
-  static_check_size;
-end;
-
-
-procedure tderivedclass.check_size;
-
-begin
-  Writeln('Calling tderived check_size method');
-  inherited check_size;
-end;
-
 var
   cb : tbaseclass;
   cd : tderivedclass;
-  c1 : pbaseclass;
 begin
  cb.init;
  cd.init;
- new(c1,init);
 
  basesize:=sizeof(cb);
  Writeln('Sizeof(cb)=',basesize);
@@ -119,35 +46,4 @@ begin
  if derivedsize<>expected_size_for_tderivedclass then
    Writeln('not the expected size : ',expected_size_for_tderivedclass);
 
- cb.check_size;
- cd.check_size;
- c1^.check_size;
- cb.static_check_size;
- cd.static_check_size;
- c1^.static_check_size;
- tbaseclass.static_check_size;
- tderivedclass.static_check_size;
- tbaseclass.check_static;
- tderivedclass.check_static;
-
- cb.check_normal;
- cb.check_static;
- cb.check_virtual;
- cd.check_normal;
- cd.check_static;
- cd.check_virtual;
-
- dispose (c1,done);
-
- c1:=new(pderivedclass,init);
- c1^.check_size;
- c1^.static_check_size;
- dispose (c1,done);
-
- if has_error then
-   begin
-     Writeln('Error with class methods');
-     halt(1);
-   end;
-
 end.