fpc/tests/test/trtti21.pp
svenbarth ca7c775e36 * fix for Mantis #38642: for enumerations with jumps Delphi behaves as follows:
- GetTypeKind returns tkEnumeration (FPC previously generated a compile error here)
  - GetTypeInfo on a generic parameters returns Nil for such types (FPC previously generated a compile error here)
  - GetTypeInfo otherwise generates a compile error (as before)

git-svn-id: trunk@49064 -
2021-03-27 09:35:07 +00:00

27 lines
521 B
ObjectPascal

{ GetTypeKind() of an enumeration with holes returns tkEnumeration and
TypeInfo() returns Nil, but *only* inside a generic/specialization when used
with a generic parameter }
program trtti21;
{$mode objfpc}
type
TEnum = (teOne = 1, teTwo);
generic TTest<T> = class
class function Test: Pointer;
end;
class function TTest.Test: Pointer;
begin
Result := TypeInfo(T);
end;
begin
if GetTypeKind(TEnum) <> tkEnumeration then
Halt(1);
if specialize TTest<TEnum>.Test <> Nil then
Halt(2);
end.