* Life-time of temporaries
@ 2010-10-30 12:03 Florian Weimer
0 siblings, 0 replies; only message in thread
From: Florian Weimer @ 2010-10-30 12:03 UTC (permalink / 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.
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2010-10-30 12:03 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-30 12:03 Life-time of temporaries Florian Weimer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox