Sven Barth wrote:
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 impolitely 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.
http://bugs.freepascal.org/view.php?id=24863
The reason I revisited this was after we were looking at apparent
zero-size record problems elsewhere.
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).
Noted, my "eye was off the ball" while I was struggling with various
errors in a test program somewhat larger than I've submitted (working up
to 3-D arrays etc.).
--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk
[Opinions above are the author's, not those of his employers or colleagues]
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal