gcc/testsuite/gnat.dg/in_out_parameter2.adb
raw| 1 | -- { dg-do run } |
| 2 | -- { dg-options "-gnat12" } |
| 3 | |
| 4 | procedure In_Out_Parameter2 is |
| 5 | |
| 6 | function F (I : In Out Integer) return Boolean is |
| 7 | A : Integer := I; |
| 8 | begin |
| 9 | I := I + 1; |
| 10 | return (A > 0); |
| 11 | end; |
| 12 | |
| 13 | I : Integer := 0; |
| 14 | B : Boolean; |
| 15 | |
| 16 | begin |
| 17 | B := F (I); |
| 18 | if B then |
| 19 | raise Program_Error; |
| 20 | end if; |
| 21 | if I /= 1 then |
| 22 | raise Program_Error; |
| 23 | end if; |
| 24 | end; |