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

git-svn-id: trunk@48452 -
This commit is contained in:
florian 2021-01-29 21:31:59 +00:00
parent e99827246e
commit 4bec57702f
3 changed files with 12 additions and 1 deletions

1
.gitattributes vendored
View File

@ -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

View File

@ -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
tests/webtbs/tw38412.pp Normal file
View File

@ -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.