[fpc-pascal] User-defined operators and dummy parameters

Sven Barth pascaldragon at googlemail.com
Sun Aug 11 12:14:14 CEST 2013


On 10.08.2013 12:04, Mark Morgan Lloyd wrote:
> Is it possible to pass a dummy parameter to a user-defined operator,
> with no expectation that it be referenced?
>
> The following test program compiles OK but fails at runtime with an
> error 217 on all platforms if the record is empty. It works if it
> contains a variant, but not reliably with other types.

It seems that the compiler does not detect here that the variants unit 
is needed and thus does not implicitely add it. Please open a bug report 
with your code as an example. As a workaround simply add the unit 
"variants" to the unit where your operator is defined.

Btw: You don't need the "s: Variant" for operators in mode Delphi or 
mode ObjFPC as there you can use "Result" as usual (just write ": 
Variant" as for normal functions).

Regards,
Sven




More information about the fpc-pascal mailing list