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.4 required=5.0 tests=BAYES_00,FORGED_MUA_MOZILLA autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,68536605ede13a20 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.68.212.232 with SMTP id nn8mr13626890pbc.1.1324199304135; Sun, 18 Dec 2011 01:08:24 -0800 (PST) Path: lh20ni36073pbb.0!nntp.google.com!news1.google.com!news3.google.com!proxad.net!feeder1-2.proxad.net!usenet-fr.net!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!news.weisnix.org!newsfeed.ision.net!newsfeed2.easynews.net!ision!newsfeed.arcor.de!newsspool1.arcor-online.net!news.arcor.de.POSTED!not-for-mail Date: Sun, 18 Dec 2011 10:08:21 +0100 From: Georg Bauhaus User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:8.0) Gecko/20111105 Thunderbird/8.0 MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: GNAT - return by anonymous access References: <784c67eb-a542-41b0-b23d-fca1234e56b2@n10g2000vbg.googlegroups.com> In-Reply-To: <784c67eb-a542-41b0-b23d-fca1234e56b2@n10g2000vbg.googlegroups.com> Message-ID: <4eedad86$0$7609$9b4e6d93@newsspool1.arcor-online.net> Organization: Arcor NNTP-Posting-Date: 18 Dec 2011 10:08:22 CET NNTP-Posting-Host: 829891bd.newsspool1.arcor-online.net X-Trace: DXC=6__Ddc\=SoQ5TOT9_N5iejVXLkXMe1DUf]]aPhadmadhbU X-Complaints-To: usenet-abuse@arcor.de Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Date: 2011-12-18T10:08:22+01:00 List-Id: On 17.12.11 20:17, Simon Belmont wrote: > begin > > Text_IO.Put_Line(foo.p_obj.all'img); > > end test_driver; Only for completeness, it will be easier to test the program with alternative compilers if implementation-defined attribute 'Img (introduced in GNAT for debugging with pragma Debug, if memory serves) is replaced with standard Ada, Text_IO.Put_Line(Integer'Image(foo.p_obj.all)); This alone does not change the output to something expected here. However, function get return test_type is begin --return test_type'(p_obj => new Integer'(42)); return result: test_type(p_obj => new Integer'(42)); end get; makes the program print 42. Maybe this is triggering some Ada 95 circuits for discriminant constraints? (Note to self: collect some statistics of GNAT failing in the presence of discriminants.)