State that declaration global operators in Delphi mode is not possible
Original Reporter info from Mantis: okobapatino @OkobaPatino
-
Reporter name: OkobaPatino
Original Reporter info from Mantis: okobapatino @OkobaPatino
- Reporter name: OkobaPatino
Description:
It is not clear from this document that it is impossible to declare a global operator for a type.
https://www.freepascal.org/docs-html/ref/refse102.html
It should be something like this that these operators are not recognized in Delphi mode:
https://www.freepascal.org/docs-html/ref/refse109.html
To be clear, this code is not possible in Delphi mode but possible in objfpc mode:
program Project1;
{$MODE Delphi}
type
complex = record
re: Real;
im: Real;
end;
operator assign (r: Real) z: complex;
begin
z.re := r;
z.im := 0.0;
end;
var
R: Real;
C: complex;
begin
C := R;
end.
Additional information:
https://forum.lazarus.freepascal.org/index.php/topic,52117.0.html
Mantis conversion info:
- Mantis ID: 38071
- Fixed in version: 3.3.1
- Fixed in revision: 1774 (#6fc62d1d).
- Monitored by: » @OkobaPatino (OkobaPatino), » @mvancanneyt (Michael Van Canneyt)
- Target version: 3.2.2