mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-07 02:48:07 +02:00

- 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 -
27 lines
521 B
ObjectPascal
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.
|