comp.lang.ada
 help / color / mirror / Atom feed
From: Georg Bauhaus <rm.dash-bauhaus@futureapps.de>
Subject: Re: GNAT - return by anonymous access
Date: Sun, 18 Dec 2011 10:08:21 +0100
Date: 2011-12-18T10:08:22+01:00	[thread overview]
Message-ID: <4eedad86$0$7609$9b4e6d93@newsspool1.arcor-online.net> (raw)
In-Reply-To: <784c67eb-a542-41b0-b23d-fca1234e56b2@n10g2000vbg.googlegroups.com>

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.)



  parent reply	other threads:[~2011-12-18  9:08 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-17 19:17 GNAT - return by anonymous access Simon Belmont
2011-12-17 19:51 ` Simon Wright
2011-12-18  9:08 ` Georg Bauhaus [this message]
2011-12-19 23:46 ` Randy Brukardt
2011-12-20  0:14   ` Shark8
2011-12-20 23:18     ` Randy Brukardt
2011-12-21  0:44       ` Simon Belmont
2011-12-21  7:29         ` AdaMagica
2011-12-21 11:05           ` Georg Bauhaus
2011-12-21 11:43             ` AdaMagica
2011-12-21 12:05               ` Georg Bauhaus
2011-12-22  0:33                 ` Randy Brukardt
2011-12-22  0:33           ` Simon Belmont
2011-12-22  7:11             ` Adam Beneschan
2011-12-22 22:11               ` Simon Belmont
2011-12-23  0:56                 ` Randy Brukardt
2011-12-23 13:20                   ` Simon Belmont
2011-12-27 23:51                     ` Randy Brukardt
2011-12-20 23:53 ` anon
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox