diff --git a/.gitattributes b/.gitattributes index b466a96ec7..6909ba1f90 100644 --- a/.gitattributes +++ b/.gitattributes @@ -10355,6 +10355,7 @@ tests/webtbs/tw16328.pp svneol=native#text/plain tests/webtbs/tw1634.pp svneol=native#text/plain tests/webtbs/tw16366.pp svneol=native#text/plain tests/webtbs/tw16377.pp svneol=native#text/plain +tests/webtbs/tw16402.pp svneol=native#text/plain tests/webtbs/tw1658.pp svneol=native#text/plain tests/webtbs/tw1677.pp svneol=native#text/plain tests/webtbs/tw1681.pp svneol=native#text/plain diff --git a/rtl/objpas/typinfo.pp b/rtl/objpas/typinfo.pp index 373412991d..8511159f0d 100644 --- a/rtl/objpas/typinfo.pp +++ b/rtl/objpas/typinfo.pp @@ -478,8 +478,8 @@ begin PS:=PShortString(pointer(PS)+PByte(PS)^+1); Inc(Count); end; - - Result := Count; + { the last string is the unit name } + Result := Count - 1; end; end; diff --git a/tests/webtbs/tw16402.pp b/tests/webtbs/tw16402.pp new file mode 100644 index 0000000000..9b6aca2489 --- /dev/null +++ b/tests/webtbs/tw16402.pp @@ -0,0 +1,7 @@ +uses typinfo; +type + TEnum = (Name1,Name2,Name3); +begin + if GetEnumNameCount(TypeInfo(TEnum))<>3 then + halt(1); +end.