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=0.7 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM,REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,c4ba91f4ae36a2c,start X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail From: "Rego, P." Newsgroups: comp.lang.ada Subject: Elaborate_All on child package Date: Sat, 3 Sep 2011 09:57:16 -0700 (PDT) Organization: http://groups.google.com Message-ID: <19a85f93-3cd2-4054-8022-21ba294d53e3@glegroupsg2000goo.googlegroups.com> Reply-To: comp.lang.ada@googlegroups.com NNTP-Posting-Host: 187.56.110.1 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: posting.google.com 1315069037 21880 127.0.0.1 (3 Sep 2011 16:57:17 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Sat, 3 Sep 2011 16:57:17 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=187.56.110.1; posting-account=TRgI1QoAAABSsYi-ox3Pi6N-JEKKU0cu User-Agent: G2/1.0 X-Google-Web-Client: true Xref: g2news2.google.com comp.lang.ada:21812 Date: 2011-09-03T09:57:16-07:00 List-Id: Hi, I'm trying to create a child package from a package which have a class, but it needs the pragma Elaborate_All so package Forum_Test is type Small_Class; type Small_Class_Acc is access all Small_Class; task type My_Task_Type (This_Small_Class : access Small_Class); type Small_Class is tagged limited record My_Task : My_Task_Type (Small_Class'Access); end record; function Construct return Small_Class_Acc; end Forum_Test; package Forum_Test.Childp is Small_Obj : Small_Class_Acc := Construct; end Forum_Test.Childp; and I got the messages forum_test-childp.ads:2:35: info: call to "Construct" during elaboration forum_test-childp.ads:2:35: info: implicit pragma Elaborate_All for "Forum_Test" generated forum_test-childp.ads:2:35: warning: call to "Construct" in elaboration code requires pragma Elaborate_All on "Forum_Test" So I included a pragma Elaborate_All in the beginning of the file, but got the message forum_test-childp.ads:1:23: argument of pragma "Elaborate_All" is not withed unit And finally I 'withed' the child package and it worked as well. However, should it be done this way? Due to it is already "withed" to the parent package, so why have I make a new with? I mean: why is the following code incorrect: pragma Elaborate_All (Forum_Test); package Forum_Test.Childp is <....> and why is the following code correct? with Forum_Test; pragma Elaborate_All (Forum_Test); package Forum_Test.Childp is <....>