mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-13 08:59:27 +02:00
* handle subrange enumeration types in GetEnumValue correctly, resolves #15467
git-svn-id: trunk@14544 -
This commit is contained in:
parent
8b27daae2c
commit
4ddebcbf1c
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -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
|
||||
|
@ -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
14
tests/webtbs/tw15467.pp
Normal 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.
|
Loading…
Reference in New Issue
Block a user