Waldek Hebisch wrote:
AFAIKS GPC implements resticted types quite unlike what EP requires.
- Restriced types should be different then underlying type (6.4.1 says
that restricted-type is a new-type, and new-type is different from other types. So according to rules for return values the following program (accepted by GPC in EP mode) is incorrect:
program prog; type a=0..5; b= restricted a; var c:a; procedure foo(function bar:b); begin end; function baz:a; begin baz := c end; begin foo(baz) end .
- According to 6.9.2.2 assignment to variable of restricted type is
legal, and IMHO the following program (rejected by GPC) is legal:
program prog; type a=0..5; b= restricted a; var c:b; begin c := 0; end .
This may well be. I think most of the `restricted' support was written before I came to GPC, so I don't know exactly what it was based on.
Before I start changing things, since I currently don't have the time to study the standard closely, could someone please describe the (expected) effects of `restricted' in plain words (assignments, var/value parameters, function results, record fields, across import/export if there's anything special etc.).
By the way, greping the testsuite for `restricted' gave me no matches...
Maybe a typo? There are some test programs (e.g. fjf594*.pas), but probably not enough (or maybe not even all correct). If someone can correct/complete them, I'd also appreciate it.
Frank