From: Florian Weimer <fw@deneb.enyo.de>
Subject: Life-time of temporaries
Date: Sat, 30 Oct 2010 14:03:00 +0200
Date: 2010-10-30T14:03:00+02:00 [thread overview]
Message-ID: <87fwvn51mz.fsf@mid.deneb.enyo.de> (raw)
Does the following program result in erroneous execution?
with Ada.Text_IO;
with System.Storage_Elements;
procedure T is
type Ref is record
Address : System.Address;
Length : System.Storage_Elements.Storage_Count;
end record;
function "+" (S : String) return Ref is
begin
return Ref'(S'Address, S'Length);
end "+";
procedure Print (R : Ref) is
subtype String_Type is String (1 .. Integer (R.Length));
S : String_Type;
pragma Import (Ada, S);
for S'Address use R.Address;
begin
Ada.Text_IO.Put_Line (S);
end Print;
begin
Print (+Integer'Image(17));
end T;
It seems to me it doesn't, thanks to the clarification in AI95-162,
although it does not seem to be the main direction of that change.
reply other threads:[~2010-10-30 12:03 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox