[fpc-devel] indexed property with default value for param?

Michael Van Canneyt michael at freepascal.org
Thu Jun 11 09:14:59 CEST 2009



On Wed, 10 Jun 2009, Martin wrote:

> Procedures/Functions can have default values for arguments, so they don't 
> need to be specified if called
> function GetFoo(Bar: integer; XY: Boolean = True): Integer;
>
> Properties (indexed) don't have such a syntax:
> property Foo[Bar: integer; XY: Boolean = True] read GetFoo;
> will give an error
>
> However the follwing Syntax compiles fine:
> function GetFoo(Bar: integer; XY: Boolean = True): Integer;
> property Foo[Bar: integer; XY: Boolean] read GetFoo;
>
> and then you can do:
> a := Object.Foo[1];
>
> But:
> Is that supposed to work?

No, it is not. It is a compiler bug. Could you please create a bug report?

Michael.



More information about the fpc-devel mailing list