Hi,

reminder:

Essence: http://bugs.freepascal.org/file_download.php?file_id=19514&type=bug
Examples: http://bugs.freepascal.org/file_download.
php?file_id=19513&type=bug
Bugtracker: http://bugs.freepascal.org/view.php?id=25607
Prev. discussion:
http://lists.freepascal.org/fpc-devel/2014-January/033232.html

During my work on Generics.Collections, SmartPointers and NewPascal.org
initiative, I have decided to split my work on many parts to be as close as
possibly to original FPC trunk by sending patches and improvements (all is
listed here http://newpascal.org/compass.html ).

One of most important parts is fix for bug #25607. FPC has problem with
calculating "distance" for methods with default parameter. Patch is
attached here and in #25607.

We have small difference with Delphi implementation for example:

===code begin===
type
  TA = class
    constructor Create(A: Integer = 0); overload; virtual;
  end;

  TB = class(TA)
    constructor Create(A: Integer); overload; override;
  end;

  TClassB = class of TB;

constructor TA.Create(A: Integer = 0);
begin
  WriteLn('TA.Create');
end;

constructor TB.Create(A: Integer);
begin
  WriteLn('TB.Create');
end;

var
  B: TB;
  ClassB: TClassB;
begin
  B := TB.Create;

  B.Create;

  ClassB := TB;
  ClassB.Create;
==code end===

Output for Delphi:
TA.Create
TB.Create
TB.Create

Output for FPC with my patch:
TB.Create
TB.Create
TB.Create

Seems like Delphi implementation is buggy (override should work for
"Create" in presented context too).

-- 
Best regards,
Maciej Izak

Attachment: compiler_patch_distance_for_black_list_19.09.2016.patch
Description: Binary data

_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply via email to