View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0021893FPCCompilerpublic2012-04-30 10:142012-05-03 21:21
ReporterJC Chu 
Assigned ToJonas Maebe 
Platformx86_64OSWindows NTOS Version6.1.7601
Product Version2.7.1Product Build 
Target VersionFixed in Version 
Summary0021893: Unnecessary warning about uninitialized fields for variant record constants
DescriptionWhen unused fields of a variant record constant are left out, the compiler issues a warning.

See attached file for a demo.
TagsNo tags attached.
Fixed in Revision
Attached Files? file icon Test.pp [^] (212 bytes) 2012-04-30 10:14

- Relationships

-  Notes
Jonas Maebe (manager)
2012-05-03 21:21

While variant records work that way in Ada, it's different in (Turbo/Delphi/FPC) Pascal. A discriminant does not limit what is or is not valid for accessing in the rest of the record. Your declaration is completely identical to the following as far as the compiler is concerned:

  TTestRec = record
    HasExtraField: Boolean;
    case byte of
      1: (ExtraField: Pointer);

Maybe somewhere in the future we will have optional functionality to add discriminant checks when accessing fields in variant records, but right now there is no functionality whatsoever in the compiler to deal with this sort of things.

- Issue History
Date Modified Username Field Change
2012-04-30 10:14 JC Chu New Issue
2012-04-30 10:14 JC Chu File Added: Test.pp
2012-05-03 21:21 Jonas Maebe Status new => resolved
2012-05-03 21:21 Jonas Maebe Resolution open => suspended
2012-05-03 21:21 Jonas Maebe Assigned To => Jonas Maebe
2012-05-03 21:21 Jonas Maebe Note Added: 0059221

MantisBT 1.2.12[^]
Copyright © 2000 - 2012 MantisBT Group
Powered by Mantis Bugtracker