new 261-262, solved 259-260

This commit is contained in:
pierre 1999-06-17 15:10:12 +00:00
parent e8da115c3f
commit a626615439
5 changed files with 208 additions and 2 deletions

View File

@ -15,6 +15,10 @@ program test;
l : longint;
end;
obj4 = object(obj3)
procedure writeit;virtual;
end;
constructor obj1.init;
begin
end;
@ -27,6 +31,10 @@ program test;
begin
end;
procedure obj4.writeit;
begin
end;
begin
end.

26
bugs/bug0261.pp Normal file
View File

@ -0,0 +1,26 @@
program bug0261;
{ test for operator overloading }
{ Copyright (c) 1999 Lourens Veen }
{ why doesn't this work? }
uses
bug0261a;
var a : mythingy;
b : myotherthingy;
c : mythirdthingy;
begin
a.x:=55;
a.y:=45;
a.c:=7;
b:=a;
c:=a;
if b.d<>c.e then
Writeln('Error in assignment overloading');
if b<>c then
Writeln('Error in equal overloading');
Writeln('Sizeof(mythirdthingy)=',sizeof(mythirdthingy));
Writeln('Sizeof(mynewthingy)=',sizeof(mynewthingy));
end.

55
bugs/bug0261a.pp Normal file
View File

@ -0,0 +1,55 @@
unit bug0261a;
{ test for operator overloading }
{ Copyright (c) 1999 Lourens Veen }
{ why doesn't this work? }
interface
type mythingy = record
x, y : longint;
c : byte;
end;
myotherthingy = record
x, y : longint;
d : byte;
end;
mythirdthingy = record
x, y : longint;
e : byte;
end;
mynewthingy = record
x, y : longint;
e,f : byte;
end;
operator := (a : mythingy) r : myotherthingy;
operator := (a : mythingy) r : mythirdthingy;
operator = (b : myotherthingy;c : mythirdthingy) res : boolean;
implementation
operator := (a : mythingy) r : myotherthingy;
begin
r.x := a.x;
r.y := a.y;
r.d := a.c;
end;
operator := (a : mythingy) r : mythirdthingy;
begin
r.x := a.x;
r.y := a.y;
r.e := a.c;
end;
operator = (b : myotherthingy;c : mythirdthingy) res : boolean;
begin
res:=(b.x=c.x) and (b.y=c.y) and (b.d=c.e);
end;
end.

114
bugs/bug0262.pp Normal file
View File

@ -0,0 +1,114 @@
program test;
type
obj1 = object
st2 : string;
constructor init;
procedure writeit;
procedure writeit(st : string);virtual;
end;
obj2 = object(obj1)
procedure writeit;virtual;
end;
obj3 = object(obj2)
l2 : longint;
procedure writeit(l : longint);virtual;
procedure writeit(st : string);virtual;
end;
obj4 = object(obj3)
procedure writeit;virtual;
procedure writeit(st : string);virtual;
end;
obj5 = object(obj4)
procedure writeit;virtual;
procedure writeit(st : string);
procedure writeit(l : longint);virtual;
end;
constructor obj1.init;
begin
end;
procedure obj1.writeit;
begin
Writeln('Obj1 writeit');
end;
procedure obj1.writeit(st : string);
begin
Writeln('Obj1 writeit(string) ',st);
end;
procedure obj2.writeit;
begin
Writeln('Obj2 writeit');
end;
procedure obj3.writeit(st : string);
begin
Writeln('Obj3 writeit(string) ',st);
end;
procedure obj3.writeit(l : longint);
begin
Writeln('Obj2 writeit(longint) ',l);
end;
procedure obj4.writeit;
begin
Writeln('Obj4 writeit');
end;
procedure obj4.writeit(st : string);
begin
Writeln('Obj4 writeit(string) ',st);
end;
procedure obj5.writeit;
begin
Writeln('Obj5 writeit');
end;
procedure obj5.writeit(st : string);
begin
Writeln('Obj5 writeit(string) ',st);
end;
procedure obj5.writeit(l : longint);
begin
Writeln('Obj5 writeit(longint) ',l);
end;
var
o1 : obj1;
o2 : obj2;
o3 : obj3;
o4 : obj4;
o5 : obj5;
begin
o1.init;
o1.writeit;
o1.writeit('o1');
o2.init;
o2.writeit;
o2.writeit('o2');
o3.init;
o3.writeit;
o3.writeit('o3');
o3.writeit(3);
o4.init;
o4.writeit;
o4.writeit('o4');
o4.writeit(4);
o5.init;
o5.writeit;
o5.writeit('o5');
o5.writeit(5);
end.

View File

@ -312,6 +312,9 @@ Fixed bugs:
bug0256.pp problem with conditionnals in TP mode OK 0.99.11 (PM)
bug0257.pp problem with procvars in tp mode OK 0.99.11 (PM)
bug0258.pp bug in small const set extension to large sets OK 0.99.12 (PM)
bug0259.pp problem with optimizer for real math (use -O1) OK 0.99.12 (PM)
bug0260.pp problem with VMT generation if non virtual
method has a virtual overload OK 0.99.12 (PM)
Unproducable bugs:
@ -347,5 +350,5 @@ bug0244.pp nested procedures can't have same name as global ones (same as bug0
bug0245.pp assigning pointers to address of consts is allowed (refused by BP !)
bug0246.pp const para can be changed without error
bug0252.pp typecasting not possible within typed const
bug0259.pp problem with optimizer for real math (use -O1)
bug0260.pp problem with VMT generation if non virtual method has a virtual overload
bug0261.pp problems for assignment overloading
bug0262.pp problems with virtual and overloaded methods