| 1 |
-- { dg-do run } |
| 2 |
-- { dg-options "-O2" } |
| 3 |
|
| 4 |
procedure self_aggregate_with_call is |
| 5 |
|
| 6 |
type Values is array (1 .. 8) of Natural; |
| 7 |
|
| 8 |
type Vector is record |
| 9 |
Components : Values; |
| 10 |
end record; |
| 11 |
|
| 12 |
function Clone (Components: Values) return Values is |
| 13 |
begin |
| 14 |
return Components; |
| 15 |
end; |
| 16 |
|
| 17 |
procedure Process (V : in out Vector) is |
| 18 |
begin |
| 19 |
V.Components (Values'First) := 1; |
| 20 |
V := (Components => Clone (V.Components)); |
| 21 |
|
| 22 |
if V.Components (Values'First) /= 1 then |
| 23 |
raise Program_Error; |
| 24 |
end if; |
| 25 |
end; |
| 26 |
|
| 27 |
V : Vector; |
| 28 |
begin |
| 29 |
Process (V); |
| 30 |
end; |