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] |
An iterator specification can include a subtype indication in the case of an array- or container-element iterator. This patch verifies that the subtype indication matches the element type of the array or container. Compiling the following must yield: range_in_iterator.adb:14:12: subtype indication does not match component type range_in_iterator.adb:20:12: subtype indication does not match element type --- with Ada.Containers.Doubly_Linked_Lists; procedure Range_In_Iterator is Zero : Integer; A : String := "hello world"; type Rec is record Val : Integer := 111; end record; package L is new Ada.Containers.Doubly_Linked_Lists (Rec); Chain : L.List; R : Rec := (Val => 12345); begin Zero := 0; for J : Integer range Zero .. 1 of A loop null; end loop; Chain.Append (R); Chain.Append (R); for C : Character of Chain loop null; end loop; end Range_In_Iterator; Tested on x86_64-pc-linux-gnu, committed on trunk 2014-01-24 Ed Schonberg <schonberg@adacore.com> * sem_ch5.adb (Analyze_Iterator_Specification): If subtype indication is given explicity, check that it matches the array component type or the container element type of the domain of iteration.
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] |