Mega Search
23.2 Million


Sign Up

Make a donation  
Why this program does not compile? (iterators)  
News Group: comp.lang.ada

Why this program does not compile?

gnatgcc -c -g -O2 -gnat2012 -g -O0 -gnato -fstack-check -gnatVa special_test.adb
: In function ‘Special_Test’:
: error: aggregate value used where an integer was expected

with Ada.Iterator_Interfaces;

procedure Special_Test is

   type My_Description_Cursor is null record;
   
   function Has_Element (Position: My_Description_Cursor) return Boolean is (False);

   package My_Description_Iterators is new Ada.Iterator_Interfaces(My_Description_Cursor, Has_Element);

   type My_Description_Iterator is new My_Description_Iterators.Forward_Iterator with null record;
   
   overriding function First (Object: My_Description_Iterator) return My_Description_Cursor is (null record);
   overriding function Next (Object: My_Description_Iterator; Position: My_Description_Cursor) return My_Description_Cursor is (null record);

   My_Iterator: My_Description_Iterator;

begin
   for C in My_Iterator loop
      null;
   end loop;
end;


-- 
Victor Porton - http://portonvictor.org

Vote for best question.
Score: 0  # Vote:  0
Date Posted: 22-Aug-2014, at 8:18 PM EST
From: Victor Porton