On 2016-01-25 16:32, Michael Van Canneyt wrote: > > They should definitely be compilable.
To make the typeinfex/*.pp examples compilable, I had to make some changes as shown below. I don't hope text wrapping screws this up, but just in case, I attached the patch too. Before, it seems it was valid to typecast a Set as Integer(), but testing with FPC 3.0 it seems typecasting as Byte() is now required. If I don't, the compile gives the following error: ex8.pp(25,17) Error: Illegal type conversion: "LongInt" to "TMyEnums" Do you know when this change was made in FPC, and where it is documented (eg: wiki User Changes ...)? ==================================== [typinfex (master)]$ git diff ex8.pp diff --git a/typinfex/ex8.pp b/typinfex/ex8.pp index 1a9d71e..e0c720c 100644 --- a/typinfex/ex8.pp +++ b/typinfex/ex8.pp @@ -20,9 +20,9 @@ begin O:=TMyTestObject.Create; O.SetField:=[mefirst,meSecond,meThird]; PI:=GetPropInfo(O,'SetField'); - Writeln('SetToString (brackets) : ',SetToString(Pi,Integer(O.SetField),True)); - Writeln('SetToString (default) : ',SetToString(Pi,Integer(O.SetField))); - O.SetField:=TMyEnums(StringToSet(PI,ConstSet)); - Writeln('Stringtoset : ',SetToString(PI,Integer(O.SetField))); + Writeln('SetToString (brackets) : ',SetToString(Pi,Byte(O.SetField),True)); + Writeln('SetToString (default) : ',SetToString(Pi,Byte(O.SetField))); + O.SetField := TMyEnums(Byte(StringToSet(PI,ConstSet))); + Writeln('StringToSet : ',SetToString(PI,Byte(O.SetField))); O.Free; end. ==================================== Regards, - Graeme - -- fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/ My public PGP key: http://tinyurl.com/graeme-pgp
diff --git a/typinfex/ex8.pp b/typinfex/ex8.pp index 1a9d71e..e0c720c 100644 --- a/typinfex/ex8.pp +++ b/typinfex/ex8.pp @@ -20,9 +20,9 @@ begin O:=TMyTestObject.Create; O.SetField:=[mefirst,meSecond,meThird]; PI:=GetPropInfo(O,'SetField'); - Writeln('SetToString (brackets) : ',SetToString(Pi,Integer(O.SetField),True)); - Writeln('SetToString (default) : ',SetToString(Pi,Integer(O.SetField))); - O.SetField:=TMyEnums(StringToSet(PI,ConstSet)); - Writeln('Stringtoset : ',SetToString(PI,Integer(O.SetField))); + Writeln('SetToString (brackets) : ',SetToString(Pi,Byte(O.SetField),True)); + Writeln('SetToString (default) : ',SetToString(Pi,Byte(O.SetField))); + O.SetField := TMyEnums(Byte(StringToSet(PI,ConstSet))); + Writeln('StringToSet : ',SetToString(PI,Byte(O.SetField))); O.Free; end.
_______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal