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

Sven Barth pascaldragon at googlemail.com
Mon Jul 23 19:47:55 CEST 2018


Martok <listbox at martoks-place.de> schrieb am Mo., 23. Juli 2018, 17:15:

> Am 23.07.2018 um 17:05 schrieb Sven Barth via fpc-pascal:
> >     Is this kind of enumerated type with constant assignment not
> supported
> >     by FPC 3.0.4?
> >
> >        TMonthType = (January=1, February, May=5,June, July);
> >
> >
> > The enumeration type itself is supported, however TypeInfo() and thus
> > GetEnumName() and friends are not.
> Instead of GetEnumName, you may use ReadStr and WriteStr - the IO
> functions use
> their separate tables, which are generated correctly even for enums with
> assignments.
>

Though you'll get an access violation if you use a value that's not part of
the enum (in the example this will happen when the loop reaches the value
3).

Regards,
Sven

>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20180723/cfdc95fc/attachment.html>


More information about the fpc-pascal mailing list