[Ada] Missing legality check on iterator over formal container
authorEd Schonberg <schonberg@adacore.com>
Wed, 23 May 2018 10:23:02 +0000 (10:23 +0000)
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>
Wed, 23 May 2018 10:23:02 +0000 (10:23 +0000)
commitac450fb2ab71dfd5bc57ea60bc00cc749d7485af
tree32492f4adda4534d18fcf83808558ded4ad908cf
parentfd82aeff6d4338a3b9f280e423ec5236ae0fc510
[Ada] Missing legality check on iterator over formal container

This patch adds a check on an iterator over a GNAT-specific formal container,
when the iterator specification includes a subtype indication that must be
compatible with the element type of the container.

2018-05-23  Ed Schonberg  <schonberg@adacore.com>

gcc/ada/

* sem_ch5.adb (Analyze_Iterator_Specification): If a subtype indication
is present, verify its legality when the domain of iteration is a
GNAT-specific formal container, as is already done for arrays and
predefined containers.

gcc/testsuite/

* gnat.dg/iter1.adb, gnat.dg/iter1.ads: New testcase.

From-SVN: r260587
gcc/ada/ChangeLog
gcc/ada/sem_ch5.adb
gcc/testsuite/ChangeLog
gcc/testsuite/gnat.dg/iter1.adb [new file with mode: 0644]
gcc/testsuite/gnat.dg/iter1.ads [new file with mode: 0644]