[Ada] Iterators are view-specific

Pierre-Marie de Rodat derodat@adacore.com
Tue Jul 23 08:13:00 GMT 2019


Operational aspects, such as Default_Iterator, are view-specific, and if
such an aspect appears on the full view of a private type, an object of
the type cannot be iterated upon if it is not in the scope of the full
view, This patch diagnoses properly an attempt to iterate over such an
object.

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

2019-07-23  Ed Schonberg  <schonberg@adacore.com>

gcc/ada/

	* aspects.ads: New table Operational_Aspect, used to distinguish
	between aspects that are view-specific, such as those related to
	iterators, and representation aspects that apply to all views of
	a type.
	* aspects.adb (Find_Aspect): If the aspect being sought is
	operational, do not ecamine the full view of a private type to
	retrieve it.
	* sem_ch5.adb (Analyze_Iterator_Specification): Improve error
	message when the intended domain of iteration does not implement
	the required iterator aspects.

gcc/testsuite/

	* gnat.dg/iter5.adb: Add an expected error.
	* gnat.dg/iter6.adb: New testcase.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.diff
Type: text/x-diff
Size: 3751 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20190723/7e28b2f5/attachment.bin>


More information about the Gcc-patches mailing list