gcc/testsuite/gnat.dg/string_slice.adb
raw| 1 | -- { dg-do run } |
| 2 | -- { dg-options "-O" } |
| 3 | |
| 4 | procedure string_slice is |
| 5 | |
| 6 | subtype Key_T is String (1 .. 3); |
| 7 | |
| 8 | function One_Xkey return Key_T is |
| 9 | Key : Key_T := "XXX"; |
| 10 | begin |
| 11 | Key (1 .. 2) := "__"; |
| 12 | return Key; |
| 13 | end; |
| 14 | |
| 15 | Key : Key_T := One_Xkey; |
| 16 | |
| 17 | begin |
| 18 | if Key (3) /= 'X' then |
| 19 | raise Program_Error; |
| 20 | end if; |
| 21 | end; |