[fpc-devel] Gaps in a non-contiguous enum

Michael Van Canneyt michael at freepascal.org
Tue Aug 16 11:23:15 CEST 2022



On Tue, 16 Aug 2022, Martin Frb via fpc-devel wrote:

> On 16/08/2022 09:37, Michael Van Canneyt via fpc-devel wrote:
>>
>> On Tue, 16 Aug 2022, Juha Manninen via fpc-devel wrote:
>>> And function GetEnumValue() is buggy.
>>
>> It is not buggy. It does not support enumerateds with gaps, because 
>> RTTI does not support enumerateds with gaps.
>> It never has.
> ...
>>
>>   Published
>>     property Fruit : TFruitMore Read FFruit Write FFruit;
> ...
>
>> If you change it to
>>
>>   EnumType:=TypeInfo(TFruitMore);
>>
>> Delphi will even write a compile-time error:
>
> Then maybe the property should not compile either.

I agree we should simply forbid it in ObjFPC mode.

>
> What is the point to allow it being published, if then you can not get 
> (correct) typeinfo? (and therefore not stream it)

Like you, I think there is no point...

Michael.


More information about the fpc-devel mailing list