Errors when overloading certain operators in advanced records in mode ObjFPC
Original Reporter info from Mantis: PascalDragon @PascalDragon
-
Reporter name: Sven Barth
Original Reporter info from Mantis: PascalDragon @PascalDragon
- Reporter name: Sven Barth
Description:
In mode ObjFPC operators can only be overloaded using their "operator tokens" (e.g. "=" instead of "Equals") [with "Explicit" being the only exception].
Now compilation fails if one of the following operators is overloaded: <, <=, >, =>, ><, <>.
Returned error for attached example:
recoverload.pp(15,20) Error: It is not possible to overload this operator. Related overloadable operators (if any) are:
recoverload.pp(15,21) Error: It is not possible to overload this operator. Related overloadable operators (if any) are:
recoverload.pp(15,21) Fatal: Syntax error, ":" expected but ">" found
Also it is currently not possible to overload the bitwise operators if the logical ones are already overloaded (or vice versa).
Steps to reproduce:
Attached is a copy of tests/test/terecs6.pp which I converted to mode ObjFPC.
The non-working operators are enabled by defining "enableoperators" and the bitwise operators by "enablebitwise".
Additional information:
The non working operators have in common that the "<" or ">" character is recognized as "_LSHARPBRACKET" resp. "_RSHARPBRACKET" and so the "in" check in "parse_operator_name" of "pdecsub.pas" fails (maybe the "block_type" should be adjusted when parsing method names, after all it works for global operators).
Mantis conversion info:
- Mantis ID: 21127
- OS: Linux
- OS Build: 3.1
- Build: 19992
- Platform: i386
- Version: 2.7.1
- Fixed in version: 2.6.4
- Fixed in revision: 25918 (#7f48ac92)