comp.lang.ada
 help / color / mirror / Atom feed
From: "Jeffrey R. Carter" <spam.jrcarter.not@spam.not.acm.org>
Subject: Re: Recommendation of safe subset of Ada to use?
Date: Sun, 6 May 2018 09:43:09 +0200
Date: 2018-05-06T09:43:09+02:00	[thread overview]
Message-ID: <pcmbmd$fee$1@dont-email.me> (raw)
In-Reply-To: <9a41b8a3-2ac9-4630-8028-2ba165b0fb0b@googlegroups.com>

On 05/05/2018 11:32 PM, gorgelo@hotmail.com wrote:
>> with Ada.Text_IO; use Ada.Text_IO;
>>
>> procedure jdoodle is
>>       type Integer_Access is access all Integer;
>>        
>>       function Inner(Value : aliased in out Integer) return Integer_Access is
>>       begin
>>           return Value'Access;
>>       end Inner;
>>        
>>       function Outer return Integer_Access is
>>           Value : aliased Integer := 0;
>>       begin
>>           return Inner(Value);
>>       end Outer;
>>        
>>       Ptr : Integer_Access := Outer;  -- !!! Dangling reference
>> begin
>>       Put_Line("Hello World");
>> end jdoodle;

This seems to violate ARM 3.10.2(29): the accessibility level of Value (the 
object passed by reference to Inner) is deeper than that of the access type 
Integer_Access. I cannot find an exception to this for aliased parameters.

-- 
Jeff Carter
"It is the German who is so uncourteous to his verbs."
A Scandal in Bohemia
122

  reply	other threads:[~2018-05-06  7:43 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-05 21:23 Recommendation of safe subset of Ada to use? joakimds
2018-05-05 21:32 ` gorgelo
2018-05-06  7:43   ` Jeffrey R. Carter [this message]
2018-05-06  8:45     ` Niklas Holsti
2018-05-06  8:52     ` gorgelo
2018-05-06 13:15     ` Jere
2018-05-06 13:47       ` Jere
2018-05-06 21:28         ` Brad Moore
2018-05-08  0:19           ` Randy Brukardt
2018-05-08  8:07             ` Simon Wright
2018-05-07 15:54 ` onox
2018-05-08  0:22   ` Randy Brukardt
2018-05-08  0:06 ` Randy Brukardt
replies disabled

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