| 1 |
-- { dg-do run } |
| 2 |
-- { dg-options "-O2" } |
| 3 |
|
| 4 |
procedure Derived_Aggregate is |
| 5 |
type Int is range 1 .. 10; |
| 6 |
type Str is array (Int range <>) of Character; |
| 7 |
|
| 8 |
type Parent (D1, D2 : Int; B : Boolean) is |
| 9 |
record |
| 10 |
S : Str (D1 .. D2); |
| 11 |
case B is |
| 12 |
when False => C1 : Integer; |
| 13 |
when True => C2 : Float; |
| 14 |
end case; |
| 15 |
end record; |
| 16 |
|
| 17 |
for Parent'Alignment use 8; |
| 18 |
|
| 19 |
type Derived (D : Int) is new Parent (D1 => D, D2 => D, B => False); |
| 20 |
|
| 21 |
function Ident (I : Integer) return integer is |
| 22 |
begin |
| 23 |
return I; |
| 24 |
end; |
| 25 |
|
| 26 |
Y : Derived := (D => 7, S => "b", C1 => Ident (32)); |
| 27 |
|
| 28 |
begin |
| 29 |
if Parent(Y).D1 /= 7 then |
| 30 |
raise Program_Error; |
| 31 |
end if; |
| 32 |
end; |