[fpc-pascal] No type info available for this type (Enumerated type with constant assignment)

Dennis dec12 at avidsoft.com.hk
Mon Jul 23 12:23:59 CEST 2018


I am trying out the examples at 
http://wiki.freepascal.org/Enumerated_types but
The following simple program will raise compiler error "No type info 
available for this typ"

I am using Lazarus 1.8.0  FPC 3.0.4   x86_64-Win64-win32/win64


program testenum;
uses typinfo, classes, sysutils;
type
   TMonthType = (January=1, February, May=5,June, July);

var i : int32;
     s : String;
begin
   for i := Ord(Low(TMonthType)) to Ord(High(TMonthType)) do
     begin
        s:= GetEnumName(TypeInfo(TMonthType), Ord(i)); <- compiler error 
pointed at the word TypeInfo
        Writeln(i.ToSTring+' -> '+s);
     end;
   readln;
end.



However, if I change to
   TMonthType = (January, February, May,June, July);

The compiler error will disappear.

Is this kind of enumerated type with constant assignment not supported 
by FPC 3.0.4?

   TMonthType = (January=1, February, May=5,June, July);

Dennis



More information about the fpc-pascal mailing list