[Ada] Spurious error with static predicate in generic unit
authorEd Schonberg <schonberg@adacore.com>
Wed, 3 Jul 2019 08:14:47 +0000 (08:14 +0000)
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>
Wed, 3 Jul 2019 08:14:47 +0000 (08:14 +0000)
commit558241c0f71b4171c471100631af79aa93c0a9e7
treefebc39487c3b4c48efa51fd799c36db4c0f6b5fd
parentb5c8da6bac845e685236eeedc02f0814c05ed42f
[Ada] Spurious error with static predicate in generic unit

This patch fixes a spurious error in a generic unit that invludes a
subtype with a static predicate, when the type is used in a case
expression.

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

gcc/ada/

* sem_ch13.adb (Build_Predicate_Functions): In a generic context
we do not build the bodies of predicate fuctions, but the
expression in a static predicate must be elaborated to allow
case coverage checking within the generic unit.
(Build_Discrete_Static_Predicate): In a generic context, return
without building function body once the
Static_Discrete_Predicate expression for the type has been
constructed.

gcc/testsuite/

* gnat.dg/predicate6.adb, gnat.dg/predicate6.ads: New testcase.
* gnat.dg/static_pred1.adb: Remove expected error.

From-SVN: r272974
gcc/ada/ChangeLog
gcc/ada/sem_ch13.adb
gcc/testsuite/ChangeLog
gcc/testsuite/gnat.dg/predicate6.adb [new file with mode: 0644]
gcc/testsuite/gnat.dg/predicate6.ads [new file with mode: 0644]
gcc/testsuite/gnat.dg/static_pred1.adb