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:
type
TSubRange=-5..5;
TEnum=(One, Two);
var
i: Int64;
begin
if i is TSubRange then
//...
If i is TEnum then
//...
If i is SmallInt then
//...
(same with "as").
> -----Original Message-----
> From: fpc-devel <[email protected]> On Behalf
> Of Ondrej Pokorny
> Sent: Saturday, 14 April 2018 19:03
> To: [email protected]
> 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.
>
> Ondrej
> _______________________________________________
> fpc-devel maillist - [email protected]
> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
_______________________________________________
fpc-devel maillist - [email protected]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel