Am 16.07.2017 um 22:39 schrieb Florian Klämpfl:
> Am 16.07.2017 um 22:15 schrieb Martok:
>>
>> However:
>> ---------------------------
>> {$mode objfpc}
>> type
>>   TExplEnum = (a=1, b=3, c=5, d=7);
>>   TSubEnum = a..d;
>>   TEnArr = array[TSubEnum] of Byte;
>>
>> begin
>>   WriteLn('SizeOf(TEnArr) = ', SizeOf(TEnArr));
>>   WriteLn('Low(TEnArr) = ', Low(TEnArr), ', ', Ord(Low(TEnArr)));
>>   WriteLn('High(TEnArr) = ', High(TEnArr), ', ', Ord(High(TEnArr)));
>> end.
>> ---------------------------
>> SizeOf(TEnArr) = 7
>> Low(TEnArr) = a, 1
>> High(TEnArr) = d, 7
>> ---------------------------
>>
>> That difference was unexpected. At least for me.
> 
> Indeed, this is a bug. IMO the declaration of TSubEnum should not be allowed.

I made a patch and tested it, however, this causes regressions in our tests, so 
I am not sure if it
should be changed.

_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply via email to