2
0
Эх сурвалжийг харах

* handle generic with ord call of sub-range and enumeration data excluding 0 correctly, resolves #38412

git-svn-id: trunk@48452 -
florian 4 жил өмнө
parent
commit
4bec57702f

+ 1 - 0
.gitattributes

@@ -18649,6 +18649,7 @@ tests/webtbs/tw38385.pp svneol=native#text/pascal
 tests/webtbs/tw38390.pp svneol=native#text/pascal
 tests/webtbs/tw3840.pp svneol=native#text/plain
 tests/webtbs/tw3841.pp svneol=native#text/plain
+tests/webtbs/tw38412.pp svneol=native#text/pascal
 tests/webtbs/tw38413.pp svneol=native#text/pascal
 tests/webtbs/tw3863.pp svneol=native#text/plain
 tests/webtbs/tw3864.pp svneol=native#text/plain

+ 1 - 1
compiler/ncon.pas

@@ -655,7 +655,7 @@ implementation
         resultdef:=typedef;
         { only do range checking when explicitly asked for it
           and if the type can be range checked, see tests/tbs/tb0539.pp }
-        if (resultdef.typ in [orddef,enumdef]) then
+        if (resultdef.typ in [orddef,enumdef]) and not(nf_generic_para in flags) then
           adaptrange(resultdef,value,nf_internal in flags,not rangecheck,rangecheck)
       end;
 

+ 10 - 0
tests/webtbs/tw38412.pp

@@ -0,0 +1,10 @@
+{ %norun }
+type
+    measure = (short := 1, long := 2);
+    generic bar<const x: measure> = object
+            public
+                const
+                    myMeasure = ord(x);
+        end;
+begin
+end.