View Issue Details

IDProjectCategoryView StatusLast Update
0033584FPCCompilerpublic2021-01-04 17:25
Reportercodz Assigned ToFlorian  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionno change required 
Platformwindows 
Product Version3.0.4 
Fixed in Version3.3.1 
Summary0033584: invalid warning
Descriptionthe compiler said :
'test.pas(6,4) Note: Private field "tObj$1.name" is never used'
and thats wrong ! , but this warning appears only if 'name' field is private , when i turn it to public it compiles without warnings
Steps To Reproduceprogram test;
type
generic tObj<T> = class
    private
      name : string;
    end;

var
   ps : specialize tObj<int32>;
begin
   ps.name := 'Object';
   readln;
end.
TagsNo tags attached.
Fixed in Revision
FPCOldBugId
FPCTarget-
Attached Files

Activities

Thaddy de Koning

2018-04-08 12:06

reporter   ~0107688

And that is correct: a private field is hidden to the implementation inside a class. You are using it as a public field. The compiler told you so... Not a bug.
Belongs on the support forums.

Serge Anvarov

2018-04-08 12:34

reporter   ~0107690

Of course, this is a bug. The private field is hidden for implementation inside a UNIT, used in a UNIT, but the compiler erroneously reports that the field is never used.

Jonas Maebe

2018-04-08 13:00

manager   ~0107692

Yes, it is a bug.

Florian

2021-01-04 17:25

administrator   ~0128078

Fixed in trunk though I cannot find the relevant revision.

Issue History

Date Modified Username Field Change
2018-04-08 08:36 codz New Issue
2018-04-08 12:06 Thaddy de Koning Note Added: 0107688
2018-04-08 12:34 Serge Anvarov Note Added: 0107690
2018-04-08 13:00 Jonas Maebe Note Added: 0107692
2021-01-04 17:25 Florian Assigned To => Florian
2021-01-04 17:25 Florian Status new => resolved
2021-01-04 17:25 Florian Resolution open => no change required
2021-01-04 17:25 Florian Fixed in Version => 3.3.1
2021-01-04 17:25 Florian FPCTarget => -
2021-01-04 17:25 Florian Note Added: 0128078