[Ada] Fix handling of inherited discriminant constraints
commitefa129331c5ceb9937c990f45f3bfd447cbe290e
authorEd Schonberg <schonberg@adacore.com>
Tue, 17 Jul 2018 08:03:49 +0000 (17 08:03 +0000)
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>
Tue, 17 Jul 2018 08:03:49 +0000 (17 08:03 +0000)
treefb1825688c2011f39a4dc73eb1dae94e9810d05c
parent6a4f3b312e2aa6016963a6befc986b93465be968
[Ada] Fix handling of inherited discriminant constraints

2018-07-17  Ed Schonberg  <schonberg@adacore.com>

gcc/ada/

* sem_util.adb (Gather_Components): A discriminant of an ancestor may
have been constrained by a later ancestor, so when looking for the
value of that hidden discriminant we must examine the stored constraint
of other ancestors than the immediate parent type.

gcc/testsuite/

* gnat.dg/discr54.adb, gnat.dg/discr54_pkg.ads: New testcase.

From-SVN: r262767
gcc/ada/ChangeLog
gcc/ada/sem_util.adb
gcc/testsuite/ChangeLog
gcc/testsuite/gnat.dg/discr54.adb [new file with mode: 0644]
gcc/testsuite/gnat.dg/discr54_pkg.ads [new file with mode: 0644]