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=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,d65138770e3daae3 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.68.219.170 with SMTP id pp10mr16523094pbc.1.1340707452139; Tue, 26 Jun 2012 03:44:12 -0700 (PDT) Path: l9ni21649pbj.0!nntp.google.com!news2.google.com!goblin3!goblin1!goblin.stu.neva.ru!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail From: Brian Drummond Newsgroups: comp.lang.ada Subject: Re: Refactoring for error: cannot inline "X" (forward instance within enclosing body) Date: Tue, 26 Jun 2012 10:44:11 +0000 (UTC) Organization: A noiseless patient Spider Message-ID: References: <7a18bc7e-2541-46f9-9d92-65d87fed06e6@googlegroups.com> Mime-Version: 1.0 Injection-Date: Tue, 26 Jun 2012 10:44:11 +0000 (UTC) Injection-Info: mx04.eternal-september.org; posting-host="DkTdSjxOCm6DqG+Uf7eArg"; logging-data="18777"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+iIjO+obP3TbneTq1y1v8ObanoG2LA6Z0=" User-Agent: Pan/0.135 (Tomorrow I'll Wake Up and Scald Myself with Tea; GIT 30dc37b master) Cancel-Lock: sha1:O5oyJY7BWLr+6B5bL7xZfkhbik8= Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Date: 2012-06-26T10:44:11+00:00 List-Id: On Tue, 26 Jun 2012 00:51:59 -0700, Keean Schupke wrote: > On Monday, 25 June 2012 20:47:21 UTC+1, Brian Drummond wrote: >> On Mon, 25 Jun 2012 06:02:21 -0700, Keean Schupke wrote: >> >> > Hi, >> > >> > >> > I am forcing the inlining of some procedures using: >> > pragma Inline_Always(X); >> > and I am getting the error: >> > cannot inline "X" (forward instance within enclosing body) > Here's the minimal test example (as minimal as I can make it so far...): This reveals that "some procedures" are (a) generic, and (b) declared in a package, and implemented in its body. Neither of these points was clear originally. Now the package is visible while compiling the outer level, but the package body is hidden, so it seems reasonable that the implementation of the procedure (to be inlined) is not visible. Presumably the "forward instance" is an empty space where the implementation has not yet been filled in. Georg points out a workaround : -gnatN performs inline expansion in the Gnat front end, which CAN see the package body while compiling the outer module. It is not clear to me : is that allowed by the LRM, or is Gnat being a little naughty here? Or has this little example caught a corner case involving generics and Inline_Always where Gnat gets it wrong? - Brian