[fpc-devel] Correct syntax for default param?
Michael Van Canneyt
michael at freepascal.org
Sat Mar 7 09:01:24 CET 2026
On Sat, 7 Mar 2026, Martin Frb via fpc-devel wrote:
> https://gitlab.com/freepascal.org/fpc/source/-/work_items/41642#note_3135425124
>> That's actually a FPC compiler bug:
>> procedure WriteProperty(Path: String; Instance: TObject;
>> PropInfo: Pointer; DefInstance: TObject = nil;
>> const OnlyProperty: array of String);
>
>
> then what is the correct syntax?
>
> The link suggests there needs to be a default value for OnlyProperty (and I
> would have expected that too).
>
> But FPC does reject *any* default. It reject the = sign itself, if any is
> added.
>
> So what is the correct syntax?
As I wrote in the ticket you refer to, it's a bug in FPC, which is
formalized in this ticket:
https://gitlab.com/freepascal.org/fpc/source/-/work_items/41644
I would expect - when the bug is corrected - that the syntax is "= Nil"
For the time being, I suggest you use an overload.
Michael.
More information about the fpc-devel
mailing list