This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
This patch fixes a bug in which if a type implements interfaces, the Default_Iterator aspect is not inherited from all interfaces, but only from the parent type. The following test should compile and run quietly. with Ada.Iterator_Interfaces; procedure Main is type Element_Type is null record; type Cursor is null record; function Has_Element (Position : in Cursor) return Boolean is (False); package Iterators is new Ada.Iterator_Interfaces (Cursor, Has_Element); type Iterable_Base is limited interface with Default_Iterator => Iterate, Iterator_Element => Element_Type, Constant_Indexing => Element; type Iterator is new Iterators.Forward_Iterator with null record; function First (This : in Iterator) return Cursor is ((others => <>)); function Next (This : in Iterator; Position : in Cursor) return Cursor is (Position); function Iterate (This : in Iterable_Base'Class) return Iterators.Forward_Iterator'Class is (Iterator'(others => <>)); function Element (This : in Iterable_Base'Class; Position : in Cursor) return Element_Type is ((others => <>)); type IDummy is limited interface; type Iterator_First is new Iterable_Base and IDummy with null record; type Iterator_Last is new IDummy and Iterable_Base with null record; A : Iterator_First; B : Iterator_Last; begin for El of A loop null; end loop; for El of B loop null; end loop; end Main; Tested on x86_64-pc-linux-gnu, committed on trunk 2017-09-08 Bob Duff <duff@adacore.com> * sem_ch3.adb (Build_Derived_Private_Type): Inherit representation items from interfaces that the derived type implements, not just from the parent type. * sem_util.ads, sem_util.adb (Abstract_Interface_List): Change this to return an empty list when there are no interfaces. * einfo.ads, sem_ch13.adb: Minor comment fixes.
Attachment:
difs
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |