This is the mail archive of the 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]

[Ada] Legality checks on indexing aspects

This patch implements the legality rules given in RM 4.1.6 on user-defined
indexing, most importantly the rule that the aspects cannot be specified for
a derived type if the parent type has such defined or inherited aspects. 

Several reports include this illegal usage, which appears to be an intuitive
(if illegal) way of creating new container types.  In order to simplify the
transition between this illegal usage and the proper one, the previous behavior
can be recovered by using the internal debugging option -gnatd.X.

This patch also handles properly element iterators over class-wide containers.

Tested on x86_64-pc-linux-gnu, committed on trunk

2014-07-31  Ed Schonberg  <>

	* sem_ch4.adb (Try_Container_Indexing): If the container type is
	class-wide, use specific type to locate iteration primitives.
	* sem_ch13.adb (Check_Indexing_Functions): Add legality checks for
	rules in RM 4.1.6 (Illegal_Indexing): New diagnostic procedure.
	Minor error message reformating.
	* exp_ch5.adb (Expand_Iterator_Loop): Handle properly Iterator
	aspect for a derived type.

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]