Invalid message "Local variable is assigned but never used"
Original Reporter info from Mantis: zex2011
-
Reporter name: Zex Atilla
Original Reporter info from Mantis: zex2011
- Reporter name: Zex Atilla
Description:
In this example the compiler will report that aForm is declared but not used, even though it was used.
procedure Test (aObject: TObject);
var
aForm: TForm;
aEvent: TNotifyEvent;
begin
if (aObject is TForm) then
begin
aForm := aObject as TForm;
aEvent := @aForm.OnClick;
end;
end;
Steps to reproduce:
Sample Lazarus project attached.
Mantis conversion info:
- Mantis ID: 26326
- OS Build: Windows 7
- Version: 2.6.2
- Fixed in version: 3.3.1
- Fixed in revision: 43804 (#00859420)