| 1 |
-- { dg-do run } |
| 2 |
|
| 3 |
procedure Enum6 is |
| 4 |
|
| 5 |
type Base_Enum is (Ten, Twenty); |
| 6 |
|
| 7 |
type Derived_Enum is new Base_Enum; |
| 8 |
for Derived_Enum use (Ten => 10, Twenty => 20); |
| 9 |
|
| 10 |
type Rep_Enum is (Ten, Twenty); |
| 11 |
for Rep_Enum use (Ten => 10, Twenty => 20); |
| 12 |
|
| 13 |
OK : Boolean := True; |
| 14 |
|
| 15 |
begin |
| 16 |
for E in Base_Enum loop |
| 17 |
if (E = Ten and then Base_Enum'Image(E) /= "TEN") |
| 18 |
or else (E = Twenty and then Base_Enum'Image(E) /= "TWENTY") |
| 19 |
then |
| 20 |
OK := False; |
| 21 |
end if; |
| 22 |
end loop; |
| 23 |
|
| 24 |
for E in Derived_Enum loop |
| 25 |
if (E = Ten and then Derived_Enum'Image(E) /= "TEN") |
| 26 |
or else (E = Twenty and then Derived_Enum'Image(E) /= "TWENTY") |
| 27 |
then |
| 28 |
OK := False; |
| 29 |
end if; |
| 30 |
end loop; |
| 31 |
|
| 32 |
for E in Rep_Enum loop |
| 33 |
if (E = Ten and then Rep_Enum'Image(E) /= "TEN") |
| 34 |
or else (E = Twenty and then Rep_Enum'Image(E) /= "TWENTY") |
| 35 |
then |
| 36 |
OK := False; |
| 37 |
end if; |
| 38 |
end loop; |
| 39 |
|
| 40 |
if not OK then |
| 41 |
raise Program_Error; |
| 42 |
end if; |
| 43 |
end; |