[Lazarus] Wrong Duplicate Identifier error message?

Special special at joepgen.com
Wed Jul 1 20:15:45 CEST 2020


Hi,

the following unit throws an (I think wrong) compile error "Duplicate 
identifier 'Connection'". This happens Lazarus with 2.0.8 under Win 10 (64).
According to Nicklaus Wirth and Kathleen Jensen ('Pascal User Manual and 
Report') there is no duplicate  identifier in this  unit, since 
'Connection' in procedure Proc ist strictly local and does not interfere 
with Identfiers outside this procedure.

Code:

unit DoubleDefinition;
{$mode objfpc}{$H+}
interface
  uses
   Classes, SysUtils, sqlite3conn, Forms, Controls, Graphics, Dialogs;
  type
    { TForm1 }
    TForm1 = class(TForm)
     Connection: TSQLite3Connection;
     procedure Proc;
   end;
var Form1: TForm1;
implementation
{$R *.lfm}
procedure TForm1.Proc;
var Connection: TSQLite3Connection;
begin
   Connection:=  TSQLite3Connection.Create(Form1);
   Connection.Free;
end;
end.

Regards --  Joe



More information about the lazarus mailing list