comp.lang.ada
 help / color / mirror / Atom feed
* Problem with limited with
@ 2013-07-26 19:14 Simon Wright
  2013-07-26 20:49 ` Jeffrey Carter
  0 siblings, 1 reply; 15+ messages in thread
From: Simon Wright @ 2013-07-26 19:14 UTC (permalink / 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


^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2013-07-28  2:51 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-26 19:14 Problem with limited with Simon Wright
2013-07-26 20:49 ` 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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox