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.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,2153d570c2f03e29 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.224.72.199 with SMTP id n7mr4414994qaj.5.1355585026331; Sat, 15 Dec 2012 07:23:46 -0800 (PST) Received: by 10.49.87.1 with SMTP id t1mr1583761qez.41.1355585026307; Sat, 15 Dec 2012 07:23:46 -0800 (PST) Path: k2ni7qap.0!nntp.google.com!fc2no919790qab.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Sat, 15 Dec 2012 07:23:46 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=206.53.78.59; posting-account=ShYTIAoAAABytvcS76ZrG9GdaV-nXYKy NNTP-Posting-Host: 206.53.78.59 References: User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <8dcc384f-e9b7-4ade-af74-9cf4532bfbe1@googlegroups.com> Subject: Re: Question about library-level functions From: sbelmont700@gmail.com Injection-Date: Sat, 15 Dec 2012 15:23:46 +0000 Content-Type: text/plain; charset=ISO-8859-1 Date: 2012-12-15T07:23:46-08:00 List-Id: On Friday, December 14, 2012 10:38:20 PM UTC-5, ytomino wrote: > > function Create return T is > > begin > > return Result : T := (Ada.Finalization.Limited_Controlled with null record) do > > Ada.Text_IO.Put_Line ("Initialize (" & System.Address_Image (Result'Address) & ")"); > > end return; > > end Create; FWIW, I have run into several occasions where GNAT 2012 extended return statements randomly try to finalize objects erroneously, though usually I end up with a program error ('finalize raised exception'). My feeling is that if you change the above to: function Create return T is begin return (Ada.Finalization.Limited_Controlled with null record); end Create; your problem could mysteriously vanish. -sb