From: Simon Wright <simon@pushface.org>
Subject: Problem with limited with
Date: Fri, 26 Jul 2013 20:14:34 +0100
Date: 2013-07-26T20:14:34+01:00 [thread overview]
Message-ID: <lywqodrv51.fsf@pushface.org> (raw)
A poster on Stack Overflow[1] has a problem with mutually recursive
types. The essence to the problem is here:
limited with Pak2;
package Pak1 is
type Pak2_T2_P is access all Pak2.T2;
task type T1 is
entry E1 (T2 : Pak2_T2_P);
end T1;
end Pak1;
package Pak2 is
task type T2 is
entry E2;
end T2;
end Pak2;
with Pak2;
package body Pak1 is
task body T1 is
The_T2 : Pak2_T2_P;
begin
accept E1 (T2 : Pak2_T2_P) do
The_T2 := T2;
end E1;
The_T2.E2; -- compilation fails
The_T2.all.E2; -- compilation succeeds
end T1;
end Pak1;
The compiler's error message is
invalid prefix in selected component "The_T2"
dereference must not be of an incomplete type (RM 3.10.1)
I can see from 3.10.1(2.2) [2] that the dereference might be incomplete
- but (2.4) seems to say it should be OK.
I note that all the examples of using limited with use anonymous access
types, which can't be used as entry parameters; if I replace
task body T1 is
The_T2 : Pak2_T2_P;
begin
by
task body T1 is
The_T2 : access Pak2.T2;
begin
then the compilation succeeds.
Does this look like a GNAT bug?
[1]
http://stackoverflow.com/questions/17869802/using-limited-with-in-ada-to-avoid-circular-dependency
[2]
http://www.adaic.org/resources/add_content/standards/12rm/html/RM-3-10-1.html#p2.2
next reply other threads:[~2013-07-26 19:14 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-26 19:14 Simon Wright [this message]
2013-07-26 20:49 ` Problem with limited with Jeffrey Carter
2013-07-26 22:17 ` Adam Beneschan
2013-07-26 22:25 ` Shark8
2013-07-26 22:35 ` Simon Wright
2013-07-27 0:17 ` Jeffrey Carter
2013-07-27 1:08 ` Adam Beneschan
2013-07-27 8:05 ` Simon Wright
2013-07-27 2:32 ` Shark8
2013-07-27 5:42 ` Jeffrey Carter
2013-07-27 16:00 ` Shark8
2013-07-27 17:13 ` Jeffrey Carter
2013-07-27 19:21 ` Simon Wright
2013-07-28 2:51 ` Randy Brukardt
2013-07-27 3:55 ` Randy Brukardt
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox