gcc/testsuite/gnat.dg/enum3.adb
raw| 1 | -- { dg-do run } |
| 2 | |
| 3 | procedure Enum3 is |
| 4 | type Enum is (Aaa, Bbb, Ccc); |
| 5 | for Enum use (1,2,4); |
| 6 | begin |
| 7 | for Lo in Enum loop |
| 8 | for Hi in Enum loop |
| 9 | declare |
| 10 | subtype S is Enum range Lo .. Hi; |
| 11 | type Vector is array (S) of Integer; |
| 12 | Vec : Vector; |
| 13 | begin |
| 14 | for I in S loop |
| 15 | Vec (I) := 0; |
| 16 | end loop; |
| 17 | if Vec /= (S => 0) then |
| 18 | raise Program_Error; |
| 19 | end if; |
| 20 | end; |
| 21 | end loop; |
| 22 | end loop; |
| 23 | end; |