[fpc-pascal] Variable visibility problem

Michael Van Canneyt michael at freepascal.org
Wed Jul 12 16:16:05 CEST 2006



On Wed, 12 Jul 2006, Alexandre Leclerc wrote:

> Hi all,
>
> in Controls.pas there is TControl.SetName(). In a form I made a procedure 
> with
>
> TMyForm.MyProcedure;
> var
> setName: string;
> begin
> //...
> end;
>
> The compiler complains about: frmMyForm.pas(467,3) Error: Duplicate
> identifier "SetName"
>
> It should do no problems. But If I want to use SetName of TControl
> then I'll specifically invoke it. Normally the local variable should
> have priority.
>
> Is it a feature of FPC? :) Or should there be a bug filling on that
> specific issue?

This is not a bug.
Your code will compile in DELPHI mode, but not in FPC mode.

Michael.



More information about the fpc-pascal mailing list