View Issue Details

IDProjectCategoryView StatusLast Update
0038412FPCCompilerpublic2021-01-29 22:32
ReporterKai Burghardt Assigned ToFlorian  
PrioritynormalSeverityminorReproducibilityhave not tried
Status resolvedResolutionfixed 
Product Version3.2.0 
Fixed in Version3.3.1 
Summary0038412: generic with constants of sub-range and enumeration data types excluding 0 fail
DescriptionZero is assumed for all constant generic parameters while parsing. I’d expect an error upon specialization, but already the generic declaration fails:
Steps To ReproduceCompilation of

unit foo;
    measure = (short := 1, long := 2);
    generic bar<const x: measure> = object
                    myMeasure = ord(x);

terminates with the error:

foo.pas(8,22) Error: Range check error while evaluating constants (0 must be between 1 and 2)
foo.pas(10,1) Fatal: There were 1 errors compiling module, stopping
Fatal: Compilation aborted
Additional InformationThe same applies to myMeasure = 123..456;
Fixed in Revision48452
Attached Files


Thaddy de Koning

2021-01-28 09:08

reporter   ~0128632

I believe this is a duplicate. Last year we had a similar report. See if I can find it.

Kai Burghardt

2021-01-28 14:23

reporter   ~0128638

Hm. I haven’t found none. I searched for “generic” and tried to find anything close to it between April last year [when constant parameters in generics became available] and now.

There are _lots_ of bug reports though that’re related to enumerations/sub-range types without zero, e.g. one of mine 0034972. Maybe you’re confusing this issue with one of those?

Issue History

Date Modified Username Field Change
2021-01-27 23:23 Kai Burghardt New Issue
2021-01-28 09:08 Thaddy de Koning Note Added: 0128632
2021-01-28 09:40 Sven Barth Tag Attached: generics
2021-01-28 14:23 Kai Burghardt Note Added: 0128638
2021-01-29 22:32 Florian Assigned To => Florian
2021-01-29 22:32 Florian Status new => resolved
2021-01-29 22:32 Florian Resolution open => fixed
2021-01-29 22:32 Florian Fixed in Version => 3.3.1
2021-01-29 22:32 Florian Fixed in Revision => 48452
2021-01-29 22:32 Florian FPCTarget => -