1-- { dg-do compile } 2-- { dg-options "-g -O" } 3 4with Ada.Unchecked_Conversion; 5 6package body Unchecked_Convert8 is 7 8 type T1 is range 0 .. 255; 9 10 type T2 is 11 record 12 A : T1; 13 B : T1; 14 end record; 15 16 for T2 use 17 record 18 A at 0 range 0 .. 7; 19 B at 1 range 0 .. 7; 20 end record; 21 22 for T2'Size use 16; 23 24 type T3 is range 0 .. (2**16 - 1); 25 for T3'Size use 16; 26 27 function T2_TO_T3 is 28 new Ada.Unchecked_Conversion (Source => T2, Target => T3); 29 30 C : constant T3 := T2_TO_T3 (S => (A => 0, B => 0)); 31 32 procedure Dummy is begin null; end; 33 34end Unchecked_Convert8; 35