c++: prvalue of array type [PR111286]
[official-gcc.git] / gcc / testsuite / gnat.dg / opt81.adb
blob057d846e5cd93d4f8217fcbd48298ea31c073f5d
1 -- { dg-do compile }
2 -- { dg-options "-O -gnatws" }
4 with Unchecked_Conversion;
6 package body Opt81 is
8 procedure Copy (From, To : Rec) is
9 Len : constant Natural := From.A.all'Length;
10 subtype Fixed_String is String (1 .. Len);
11 type Fixed_String_Access is access Fixed_String;
12 function To_Fixed is new
13 Unchecked_Conversion (Source => String_Access,
14 Target => Fixed_String_Access);
15 S : Fixed_String_Access := To_Fixed (To.A);
16 begin
17 S (1 .. Len) := From.A.all;
18 end;
20 end Opt81;