Re: function-identifier-variable
Waldek Hebisch <[email protected]> Mon, 28 Mar 2016 22:11:03 +0200 (CEST)
| Newsgroups | gmane.comp.compilers.gpc |
|---|---|
| Message-ID | <[email protected]> |
Paul Isaacs wrote:
>
> Hello;
>
> program test;
>
> {
> productions:
>
> assignment-statement : contains expression
> expression : contains
> simple-expression
> simple-expression : eventually works
> down to primary
> primary : contains
> variable-access
> variable-access : contains
> function-identifier-variable
> function-identifier-variable = pointer-function '^'
> pointer-function : contains
> entire-function-access
> entire-function-access = function-designator
> function-designator = function-name [
> actual-parameter-list ]
> function-name : contains identifier
> }
>
> {
> compiled with:
>
> $PASCAL/local/bin/gpc --extended-pascal test.pas
> test.pas: In main program:
> test.pas:11: error: invalid type of argument of `^'
> }
>
> function y : boolean;
> begin
> y := false;
> end;
>
> var
> x : boolean;
> begin
> x := y^; { isn't " y" a function-identifier-variable ? }
> end.
>
> Where is the error in thinking?
You look only at syntax. Syntax is OK. But you also need correct
types: function 'y' have to return pointers. And the message
say this...
In particular in 6.8.6.4 the second statement reads:
: A pointer-function shall be a function-access possessing
: a pointer-type.
--
Waldek Hebisch
_______________________________________________
Gpc mailing list
[email protected]
https://www.g-n-u.de/mailman/listinfo/gpc