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
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to