| 1 |
-- { dg-do run } |
| 2 |
|
| 3 |
procedure Generic_Comp is |
| 4 |
|
| 5 |
generic |
| 6 |
type Element_Type is private; |
| 7 |
type Index_Type is (<>); |
| 8 |
type Array_Type is array (Index_Type range <>) of Element_Type; |
| 9 |
with function ">" (Left, Right : Element_Type) return Boolean is <>; |
| 10 |
procedure Gen (Data: in out Array_Type); |
| 11 |
|
| 12 |
procedure Gen (Data: in out Array_Type) is |
| 13 |
begin |
| 14 |
if not (Data'Length > 1) |
| 15 |
or else not (Integer'(Data'Length) > 1) |
| 16 |
or else not Standard.">" (Data'Length, 1) |
| 17 |
or else not Standard.">" (Integer'(Data'Length), 1) |
| 18 |
then |
| 19 |
raise Program_Error; |
| 20 |
end if; |
| 21 |
end; |
| 22 |
|
| 23 |
type My_Array is array (Positive range <>) of Integer; |
| 24 |
|
| 25 |
function Less_Than (L, R : Integer) return Boolean is |
| 26 |
begin |
| 27 |
return L < R; |
| 28 |
end; |
| 29 |
|
| 30 |
procedure Chk_Down is new Gen (Element_Type => Integer, |
| 31 |
Index_Type => Positive, |
| 32 |
Array_Type => My_Array, |
| 33 |
">" => Less_Than); |
| 34 |
|
| 35 |
Data : My_Array (1 .. 2); |
| 36 |
|
| 37 |
begin |
| 38 |
Chk_Down (Data); |
| 39 |
end; |