3 with Ada
.Iterator_Interfaces
;
7 type Item
(<>) is limited private;
10 type Cursor
is null record;
12 function Constant_Reference
(The_Item
: aliased Item
;
13 Unused_Index
: Cursor
) return String
16 function Has_More
(Data
: Cursor
) return Boolean is (False);
18 package List_Iterator_Interfaces
is new Ada
.Iterator_Interfaces
21 function Iterate
(The_Item
: Item
)
22 return List_Iterator_Interfaces
.Forward_Iterator
'class
23 is (raise Program_Error
);
25 type Item
(Name_Length
: Natural) is tagged limited record
29 Constant_Indexing
=> Constant_Reference
,
30 Default_Iterator
=> Iterate
,
31 Iterator_Element
=> String;
34 type Item_Ref
is access Item
;
35 function F
return Item_Ref
is (null);
37 for I
of F
.all loop -- { dg-error "cannot iterate over \"Item\"" }