[fpc-devel] Another bug or feature

Juha Manninen juha.manninen62 at gmail.com
Mon Nov 25 15:13:16 CET 2013


This is related to issue #24907.
In the comment I explain the problem :
  http://bugs.freepascal.org/view.php?id=24907#c71475
but I copy it also here below.
Now, is it a bug or feature?
Otherwise not a big deal but CodeTools follow FPC behavior and the
Delphi converter uses CodeTools. Apparently valid Delphi code cannot
be converted because of this problem.

---

Neither codetools nor FPC 2.6.2 supports the "operator <" syntax in
{$mode delphi}. It is ok in {$mode objfpc}.
Try to code complete and compile the code below. Then try again with
{$mode objfpc}.
How does FPC trunk behave?
If the syntax is indeed supported by Delphi then this is a bug in
FPC's mode delphi. Codetools only follows the syntax rules of FPC.
Who will open a report for FPC?

-----------------------
unit Unit2;
{$mode delphi}
interface

type
  TRootMove = record
    score: integer;
    node_count: uint64;
  end;

  operator < (m1, m2: TRootMove) LessThan : Boolean;

implementation

operator < (m1, m2: TRootMove) LessThan : Boolean;
begin
  if m1.score <> m2.score then
    result := m1.score < m2.score
  else
    result := m1.node_count < m2.node_count;
end;

end.



More information about the fpc-devel mailing list