[Ada] Expr. func. with private formal rejected in nested Ghost package
authorGary Dismukes <dismukes@adacore.com>
Thu, 4 Jul 2019 08:06:49 +0000 (08:06 +0000)
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>
Thu, 4 Jul 2019 08:06:49 +0000 (08:06 +0000)
commit901a52ba7d5c1f530e60f0b615ee16889786532a
tree8ebad73048377afd4c605abc7e694d7617b82dcb
parent3cc0fae4334466cc8da40e454455b08e83c9e932
[Ada] Expr. func. with private formal rejected in nested Ghost package

The compiler prematurely freezes a private type that is the type of a
formal parameter of an expression function declared within a nested,
inactivated Ghost package, resulting is an error complaining that the
private type must be fully defined at that point. This is fixed by
testing for Ignored_Ghost_Entity in the condition guarding the code that
performs Mask_Unfrozen_Types for an expression function without a
separate declaration, ensuring that the expression function's profile
isn't frozen prematurely.

2019-07-04  Gary Dismukes  <dismukes@adacore.com>

gcc/ada/

* sem_ch6.adb (Analyze_Subprogram_Body_Helper): The special
treatment of calling Mask_Unfrozen_Types must also be done in
the case of an Ignored_Ghost_Entity, because Expander_Active is
False in that case.

gcc/testsuite/

* gnat.dg/ghost5.adb, gnat.dg/ghost5.ads,
gnat.dg/ghost5_parent.ads: New testcase.

From-SVN: r273065
gcc/ada/ChangeLog
gcc/ada/sem_ch6.adb
gcc/testsuite/ChangeLog
gcc/testsuite/gnat.dg/ghost5.adb [new file with mode: 0644]
gcc/testsuite/gnat.dg/ghost5.ads [new file with mode: 0644]
gcc/testsuite/gnat.dg/ghost5_parent.ads [new file with mode: 0644]