c++: prvalue of array type [PR111286]
[official-gcc.git] / gcc / testsuite / gnat.dg / ai12_0086_example.adb
blob4ea6f6a88a5a06b42985824fd1ee9f677fc6ffc6
1 -- { dg-do compile }
2 -- { dg-options "-gnatX" }
4 procedure 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;
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;
16 function Make (D : S) return Rec is
17 begin
18 return (D => D, Foo => 123, Bar => 456); -- legal
19 end;
20 begin
21 if Make (Ff).Bar /= 456 then
22 raise Program_Error;
23 end if;
24 end AI12_0086_Example;