I haven't checked out the changes you made to the compiler, so you might have
already covered this, but while you are at it, you might want to just make this
work for any ordinal type with a well-defined upper/lower bound (any type for
which High()/Low() can be evaluated at compile time). So:
if i is TSubRange then
If i is TEnum then
If i is SmallInt then
(same with "as").
> -----Original Message-----
> From: fpc-devel <fpc-devel-boun...@lists.freepascal.org> On Behalf
> Of Ondrej Pokorny
> Sent: Saturday, 14 April 2018 19:03
> To: firstname.lastname@example.org
> Subject: Re: [fpc-devel] Dangerous optimization in CASE..OF
> On 14.04.2018 10:39, Thorsten Engler wrote:
> > How about following the same schema as with classes?
> > If 1 is TMyEnum then
> > //use hard cast here
> Yes, that is reasonable as well and it will be easier to implement
> than the TryIntToEnum/IntToEnum intrinsics for me.
> fpc-devel maillist - email@example.com
fpc-devel maillist - firstname.lastname@example.org