Alex R. Mosteo writes:
> Hello people,
>
> Gnat is giving me an error depending on if I use the .all
> abbreviation or not. I had the (unresearched) idea that there
> should be no differences besides the aesthetic one[*], so I'm not
> sure if gnat's wrong or I'm (guess what ;) )
>
> One way or the other, I'd like to know the explanation. The
> particular case that is giving me problems in GPL 2007 is:
>
> protected type Safe;
> type Safe_Access is access all Safe;
> function S return Safe_Access;
>
> S.Some_Procedure;
> -- This fails with
> -- Prefix of protected procedure or entry call must be variable
>
> S.all.Some_Procedure;
> -- This compiles and runs OK.
>
> Your judgment?
The compiler is correct.
6.4(9): "When there is an actual_parameter_part, the prefix can be an
implicit_dereference of an access-to-subprogram value."
In other words, in the absence of actual parameters, you must use an
explicit_dereference, i.e. you must specify ".all".
--
Ludovic Brenta.


|