Require target lra in gcc.dg/pr108095.c
[official-gcc.git] / gcc / testsuite / gnat.dg / iter6.adb
blob371352bc2f927abfce51cea7f4574a0aeb0aa170
1 -- { dg-do compile }
3 with Ada.Iterator_Interfaces;
5 procedure Iter6 is
6 package Pkg is
7 type Item (<>) is limited private;
8 private
10 type Cursor is null record;
12 function Constant_Reference (The_Item : aliased Item;
13 Unused_Index : Cursor) return String
14 is ("");
16 function Has_More (Data : Cursor) return Boolean is (False);
18 package List_Iterator_Interfaces is new Ada.Iterator_Interfaces
19 (Cursor, Has_More);
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
26 null;
27 end record
28 with
29 Constant_Indexing => Constant_Reference,
30 Default_Iterator => Iterate,
31 Iterator_Element => String;
32 end Pkg; use Pkg;
34 type Item_Ref is access Item;
35 function F return Item_Ref is (null);
36 begin
37 for I of F.all loop -- { dg-error "cannot iterate over \"Item\"" }
38 null;
39 end loop;
40 end;