Warn: Variable does not seem to be initialized for advancedrecords
Original Reporter info from Mantis: zamtmn @zamtmn
-
Reporter name: Andrey Zubarev
Original Reporter info from Mantis: zamtmn @zamtmn
- Reporter name: Andrey Zubarev
Description:
program Project1;
{$ModeSwitch advancedrecords}
type
TDummyAdvRec=record
dummy:integer;
procedure DoSomething;
constructor Init(ADummy:integer);
end;
var
D:TDummyAdvRec;
procedure TDummyAdvRec.dosomething;
begin
write(D.dummy);
end;
constructor TDummyAdvRec.Init(ADummy:integer);
begin
dummy:=ADummy;
end;
procedure Test(D:TDummyAdvRec);
begin
write(D.dummy);
end;
begin
//D.Init(0);
D.DoSomething;
Test(D);
end.
This code does not cause warnings. If comment D.DoSomething, this give
project1.lpr(33,9) Warning: Variable "D" does not seem to be initialized
I think that this warning should be generated in the uncommented version as well.
Without a warning, there should only be a variant with the use of a constructor or other initial value assignment.
Mantis conversion info:
- Mantis ID: 38379