[Lazarus] Typecast set to byte in mode OBJFPC

Jürgen Hestermann juergen.hestermann at gmx.de
Wed Dec 31 16:40:17 CET 2014


I have a unit that is compiling in DELPHI mode
but now wanted to change it to OBJFPC mode
(in DELPHI mode I cannot use binary constants %10011100).

But OBJFPC mode I get an "illegal type conversion" with the following code:

---------------------------------------------------------------
type FlagType        = (Flag1,Flag2);
          FlagSetType   = set of FlagType;
var i : SizeInt;
       S : FlagSetTyp;

S := [Flag1];
i := byte(S); // <---- Error "illegal type conversion"
---------------------------------------------------------------

Any idea how to convince the compiler to typecast
the set to byte in OBJFPC mode too?




More information about the Lazarus mailing list