[Ada] Spurious visibility error on dynamic_predicate aspect in generic

Programming / Compilers / GCC - pmderodat [138bc75d-0d04-0410-961f-82ee72b054a4] - 8 July 2019 08:12 EDT

This patch fixes a spurious error when verifying that the visibility of the expression of an aspect has not changed between the freeze point of the entity to which it applies, and the end of the enclosing declarative part. If the entity is a composite type its components must be made directly visible for the analysis of the expression. In a generic context this must be done explicitly at the end of the declarative part.

2019-07-08 Ed Schonberg

gcc/ada/

- sem_ch13.adb (Check_Aspect_At_End_Of_Declarations): For an unanalized aspect in a generic context that has not been analyzed yet, if the aspect applies to a type, place the type on the scope stack to make its components visible, before checking conformance with the version of the expression analyzed at the freeze point.

gcc/testsuite/

- gnat.dg/predicate8.adb, gnat.dg/predicate8_pkg.adb, gnat.dg/predicate8_pkg.ads: New testcase.

429822c1874 [Ada] Spurious visibility error on dynamic_predicate aspect in generic
gcc/ada/ChangeLog | 9 ++++
gcc/ada/sem_ch13.adb | 18 +++++--
gcc/testsuite/ChangeLog | 5 ++
gcc/testsuite/gnat.dg/predicate8.adb | 15 ++++++
gcc/testsuite/gnat.dg/predicate8_pkg.adb | 64 +++++++++++++++++++++++++
gcc/testsuite/gnat.dg/predicate8_pkg.ads | 81 ++++++++++++++++++++++++++++++++
6 files changed, 189 insertions(+), 3 deletions(-)

Upstream: gcc.gnu.org


  • Share