Overloading operators that involve Sets and Ordinals
Original Reporter info from Mantis: PascalDragon @PascalDragon
-
Reporter name: Sven Barth
Original Reporter info from Mantis: PascalDragon @PascalDragon
- Reporter name: Sven Barth
Description:
As mentioned in my two mails ( http://www.hu.freepascal.org/lists/fpc-pascal/2010-October/026913.html , http://www.hu.freepascal.org/lists/fpc-pascal/2010-October/027080.html ) I've some problems with overloading assignment operators that assign from an Ordinal to a Set or from a Set to an Ordinal (I was no longer able to reproduce the problem with Strings as mentioned in my second mail).
E.g.:
operator := (aRight: LongWord) aLeft: TMySet;
operator := (aRight: TMySet) aLeft: LongWord;
The operators themselves compile without problems, but when I try to use them I get the following error:
Error: Incompatible types: got "LongWord" expected "TMySet"
Steps to reproduce:
Compile the attached example.
If you enable the "t := i" line you'll get the mentioned error above, if not it will successfully compile and just print some warnings.
Additional information:
This is mostly useful when converting C style flag ordinals to Pascal sets or reverse. :)
Mantis conversion info:
- Mantis ID: 17846
- OS: Linux
- OS Build: 2.6.35
- Platform: i386
- Version: 2.5.1
- Fixed in version: 2.6.0
- Fixed in revision: 16449 (#edfb31c0)