The error message is: p.adb:7:03: unconstrained subtype not allowed (need initialization) p.adb:7:03: provide initial value or explicit discriminant values p.adb:7:03: or give default discriminant values for type "Rec"
and is issued by every compiler I tried. This doesn't happen if the parameter is In Out instead of Out. The problem is that the compiler doesn't initialize the temporary it creates around the call in the Out case. This blocks the 2nd part of the fix for R914-006. -- Eric Botcazou
with Q; use Q; procedure P is D : Derived; begin Proc1 (Rec (D)); Proc2 (Rec (D)); end;
package Q is type T_Unsigned8 is new Natural range 0 .. (2 ** 8 - 1); type Rec (Discriminant : T_Unsigned8) is record Fixed_Field : T_Unsigned8; case Discriminant is when 0 => Optional_Field : T_unsigned8; when others => null; end case; end record; type Derived is new Rec (0); for Derived use record Fixed_Field at 0 range 0 .. 7; Discriminant at 0 range 8 .. 15; Optional_Field at 0 range 16 .. 23; end record; procedure Proc1 (R : in out Rec); procedure Proc2 (R : out Rec); end Q;