1-- { dg-do compile } 2-- { dg-options "-gnatX" } 3 4procedure AI12_0086_Example is 5 type Enum is (Aa, Bb, Cc, Dd, Ee, Ff, Gg, Hh, Ii, Jj, Kk, Ll, MM, 6 Nn, Oo, Pp, Qq, Rr, Ss, Tt, Uu, Vv, Ww, Xx, Yy, Zz); 7 subtype S is Enum range Dd .. Hh; 8 9 type Rec (D : Enum) is record 10 case D is 11 when S => Foo, Bar : Integer; 12 when others => null; 13 end case; 14 end record; 15 16 function Make (D : S) return Rec is 17 begin 18 return (D => D, Foo => 123, Bar => 456); -- legal 19 end; 20begin 21 if Make (Ff).Bar /= 456 then 22 raise Program_Error; 23 end if; 24end AI12_0086_Example;