* handle subrange enumeration types in GetEnumValue correctly, resolves #15467

git-svn-id: trunk@14544 -
This commit is contained in:
florian 2010-01-05 16:10:13 +00:00
parent 8b27daae2c
commit 4ddebcbf1c
3 changed files with 16 additions and 2 deletions

1
.gitattributes vendored
View File

@ -10177,6 +10177,7 @@ tests/webtbs/tw15391.pp svneol=native#text/plain
tests/webtbs/tw15415.pp svneol=native#text/plain
tests/webtbs/tw15446.pp svneol=native#text/plain
tests/webtbs/tw15453a.pp svneol=native#text/plain
tests/webtbs/tw15467.pp svneol=native#text/pascal
tests/webtbs/tw1567.pp svneol=native#text/plain
tests/webtbs/tw1573.pp svneol=native#text/plain
tests/webtbs/tw1592.pp svneol=native#text/plain

View File

@ -421,12 +421,11 @@ begin
end
else
begin
PS:=@PT^.NameList;
While (Result=-1) and (PByte(PS)^<>0) do
begin
If ShortCompareText(PS^, sName) = 0 then
Result:=Count;
Result:=Count+PT^.MinValue;
PS:=PShortString(pointer(PS)+PByte(PS)^+1);
Inc(Count);
end;

14
tests/webtbs/tw15467.pp Normal file
View File

@ -0,0 +1,14 @@
program test;
uses typinfo;
Type
E1 = (en1,en2,en3,en4,en5);
E2 = en3..en5;
begin
if (GetEnumValue(TypeInfo(E1),'en5') <> 4) then
halt(1);
if (GetEnumValue(TypeInfo(E2),'en5') <> 4) then
halt(1);
writeln('ok');
end.