Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

elab pragma placement

59 views
Skip to first unread message

Simon Belmont

unread,
Jan 21, 2023, 6:43:33 PM1/21/23
to
Where is the right spot to apply an elaboration pragma to a library level subprogram? GNAT (20210519-103) complains that in the below code C cannot with subprogram A.B because it's not Pure, but it certainly appears to be, and no amount of shuffling around the pragma in B seems to placate it. Playing with the declaration of T seems to change the behavior; is GNAT is just misreporting a different error?

Thanks

-sb


package A is
pragma Pure;
type T is limited null record;
end A;

procedure A.B (x : T) is
pragma Pure; -- is this the right spot?
begin
null;
end A.B;

with A.B; -- error: cannot depend on "B" (wrong categorization)
package C is
pragma Pure;
end C;

Luke A. Guest

unread,
Jan 22, 2023, 3:17:52 AM1/22/23
to
On 21/01/2023 23:43, Simon Belmont wrote:
> Where is the right spot to apply an elaboration pragma to a library level subprogram? GNAT (20210519-103) complains that in the below code C cannot with subprogram A.B because it's not Pure, but it certainly appears to be,

To be pure it can contain only things that can be pre-elaborated, iirc,
so only types, no functions.

AdaMagica

unread,
Jan 22, 2023, 4:55:09 AM1/22/23
to
A subprogram is a program unit and may be declared pure. I do not see that A.B performs any of 10.2.1(15ff).

I tried
procedure A.B (x : T) with Pure;
which is accepted together with its body and still got the compiler complaint.

Looks like a compiler problem.

Rod Kay

unread,
Jan 22, 2023, 6:14:00 PM1/22/23
to
If you are on linux, then you could set the stack size with

$ ulimit -s unlimited
$ launch_my_app



Regards.

Rod Kay

unread,
Jan 22, 2023, 6:17:57 PM1/22/23
to
Sorry, wrong thread :/ .
0 new messages