[fpc-pascal] Constants in generics

Sven Barth pascaldragon at googlemail.com
Wed Jan 9 20:35:39 CET 2019


Am Mi., 9. Jan. 2019, 17:03 hat Ryan Joseph <ryan at thealchemistguild.com>
geschrieben:

>
>
> > On Jan 8, 2019, at 3:49 PM, Benito van der Zander <benito at benibela.de>
> wrote:
> >
> > that reminds me of https://bugs.freepascal.org/view.php?id=34232
>
> In this case maybe generics should just not give range errors unless
> they’re specialized? This bug and the problem I have are only for
> unspecialized generics. That would be the easiest and laziest thing to do
> but it would mean this would compile:
>
> type
>         generic TList<T> = record
>                 list: array[0..0-1] of integer;
>         end;
>

Which is why I said that this is not the way to go. You need to disable
range checks only for those symbols that must not use it. Maybe add a
"undefined" flag to tconstsym which is set in your
tconstsym.create_undefined and not changed when the const type is changed.

Regards,
Sven

>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20190109/cebe8c14/attachment.html>


More information about the fpc-pascal mailing list