| Anonymous | Login | Signup for a new account | 2013-05-24 04:10 CEST | ![]() |
| All Projects | FPC | Lazarus: Packages, Patches | Lazarus CCR | Mantis | fpGUI | fpcprojects: fpprofiler |
| Main | My View | View Issues | Change Log | Roadmap |
| View Issue Details [ Jump to Notes ] | [ Issue History ] [ Print ] | ||||||||
| ID | Project | Category | View Status | Date Submitted | Last Update | ||||
| 0021893 | FPC | Compiler | public | 2012-04-30 10:14 | 2012-05-03 21:21 | ||||
| Reporter | JC Chu | ||||||||
| Assigned To | Jonas Maebe | ||||||||
| Priority | normal | Severity | minor | Reproducibility | always | ||||
| Status | resolved | Resolution | suspended | ||||||
| Platform | x86_64 | OS | Windows NT | OS Version | 6.1.7601 | ||||
| Product Version | 2.7.1 | Product Build | |||||||
| Target Version | Fixed in Version | ||||||||
| Summary | 0021893: Unnecessary warning about uninitialized fields for variant record constants | ||||||||
| Description | When unused fields of a variant record constant are left out, the compiler issues a warning. See attached file for a demo. | ||||||||
| Tags | No tags attached. | ||||||||
| FPCOldBugId | |||||||||
| Fixed in Revision | |||||||||
| Attached Files | |||||||||
Notes |
|
|
(0059221) 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); end; 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 | |
| Main | My View | View Issues | Change Log | Roadmap |



