View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0038379 | FPC | Compiler | public | 2021-01-21 10:20 | 2021-01-24 17:30 |
Reporter | Andrey Zubarev | Assigned To | |||
Priority | normal | Severity | minor | Reproducibility | have not tried |
Status | feedback | Resolution | open | ||
Summary | 0038379: Warn: Variable does not seem to be initialized for advancedrecords | ||||
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. | ||||
Tags | No tags attached. | ||||
Fixed in Revision | |||||
FPCOldBugId | |||||
FPCTarget | - | ||||
Attached Files |
|
|
Which version? In FPC 3.2.0, there is no warning in both cases, so the problem is present. Is the use of a global variable instead of Self in line 16 intentional, or is it just a copy-paste error? |
|
Is it needed that an advanced record is initialized by a constructor? It could be also initalized by the DoSomething call, no? |
Date Modified | Username | Field | Change |
---|---|---|---|
2021-01-21 10:20 | Andrey Zubarev | New Issue | |
2021-01-23 07:01 | Serge Anvarov | Note Added: 0128497 | |
2021-01-24 17:29 | Florian | Note Added: 0128561 | |
2021-01-24 17:30 | Florian | Status | new => feedback |
2021-01-24 17:30 | Florian | FPCTarget | => - |