From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: border1.nntp.dca3.giganews.com!border2.nntp.dca3.giganews.com!border4.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!news.bbs-scene.org!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Problem with limited with Date: Fri, 26 Jul 2013 20:14:34 +0100 Organization: A noiseless patient Spider Message-ID: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mx05.eternal-september.org; posting-host="d88aa8a0fafe4f7fb3eb325f8f3d97d0"; logging-data="30323"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+1gsGAu0+24KQmxfbBYZDzuwzJm6eRg5k=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (darwin) Cancel-Lock: sha1:6WuKx5flySuO6zl3kjvgYt4l0vQ= sha1:XHbkEDQiMKDK5lKx1RkMrAOxZp4= X-Original-Bytes: 2457 Xref: number.nntp.dca.giganews.com comp.lang.ada:182689 Date: 2013-07-26T20:14:34+01:00 List-Id: 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