Sorry for replying twice to the same post.
On Sun, Nov 30, 2003 at 06:46:06PM +0100, 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 .
The problem with functional parameters seems to be more general, there is nothing special with restricted types. For example, the following program is also incorrect, and accepted by GPC:
program prog; type a=0..5; var c:a; procedure foo(function bar:integer); begin end; function baz:a; begin baz := c end; begin foo(baz) end .
Emil