Hi

On the main WWW page you wrote that the development of FPC will be focused on 1.1 version. However, are you planning to work on 1.0.11 version, i.e. 1.0.10 + fixes branch ?

If the answer is "yes", I have two bugs that I found in FPC 1.0.10. The first bug was already present in late FPC 1.0.7 versions and I reported it to this list - but I received no response to my letter. None of this bugs were present in FPC 1.0.6. I really appreciate your work on the best Pascal compiler ever, but it's a shame that new FPC version introduces _new_ bugs compared with the old 1.0.6.

I'm attaching two sources with comments that demonstrate the bugs.

Regards,
Michalis Kamburelis
--
[EMAIL PROTECTED]
http://www.camelot.homedns.org/~michalis/ (in Polish)
{ Assertion in Proc() will FAIL if you compile this with fpc 1.0.10.
  It means that "method" was not passed properly to Proc().

  If you change the code
    procedure TObj.CallProcWithMyMethod; begin Proc(MyMethod) end;
  into
    procedure TObj.CallProcWithMyMethod; begin Proc(Self.MyMethod) end;
  (i.e. you explicitly give the "Self" qualifier)
  everything will be fine (Assertion will pass).
}

{$mode DELPHI}
{$assertions+}

uses SysUtils;

type
  TProcOfObj=procedure of object;

procedure Proc(method:TProcOfObj);
var m2:TMethod absolute method;
begin
 Assert(m2.Code <> nil);
end;

type
  TObj=class
    procedure MyMethod;
    procedure CallProcWithMyMethod;
  end;

procedure TObj.MyMethod; begin end;
procedure TObj.CallProcWithMyMethod; begin Proc(MyMethod) end;

var o:TObj;
begin
 o:=TObj.Create;
 try
  o.CallProcWithMyMethod;
 finally o.Free end;
end.
{ This is a compile-time bug.
  Any of the following "const" expressions will cause compiler error in
  FPC 1.0.7 (versions dated April 2003 and later ones) and 1.0.10.
  
  I know that always SizeOf(TObject) = SizeOf(Pointer) but it's sometimes
  useful to use SizeOf(TYPE) where TYPE is a macro. In this case,
  SizeOf(TObject) must work. BTW it worked in FPC 1.0.6. }

{ SizeOf(TObject) results in "Error: Illegal expression" }
const D1 = SizeOf(TObject);

type TObj = class(TObject);

{ SizeOf(any class) results in "Error: Illegal expression" }
const D2 = SizeOf(TObj);

var
  O1:TObject;
  O2:TObj;
  
{ SizeOf(TObject instance) results in "Error: Illegal expression" }
const D3 = SizeOf(O1);

{ SizeOf(any class instance) results in "Error: Illegal expression" }
const D4 = SizeOf(O2);

begin
end.

Reply via email to