https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122161

--- Comment #6 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Marc Poulhies <[email protected]>:

https://gcc.gnu.org/g:e95656d98401f820227a194de20233256c511f85

commit r16-4968-ge95656d98401f820227a194de20233256c511f85
Author: Eric Botcazou <[email protected]>
Date:   Mon Oct 6 21:36:56 2025 +0200

    ada: Fix visibility issue in nested instance with use clause for formal
package

    The compiler gives a spurious visibility error for a formal object
parameter
    of a formal package with a use clause, present in a parent instance, when
an
    instance of a child generic unit is compiled, while this does not happen in
    the same circumstances for a formal type parameter.

    The discrepancy comes from the Check_Generic_Actuals procedure, which
clears
    the Is_Hidden flag on all the actuals of a generic instance, but only sets
    the Is_Potentially_Use_Visible flag on the actuals for formal types.

    The change also contains a fix for a pasto in Restore_Private_Views, which
    is responsible for undoing the changes made by Check_Generic_Actuals.

    gcc/ada/ChangeLog:

            PR ada/122161
            * sem_ch12.adb (Check_Generic_Actuals): Consistently set the
            Is_Potentially_Use_Visible flag on actuals whenever the Is_Hidden
            flag is cleared.
            (Restore_Private_Views): Clear the Is_Potentially_Use_Visible flag
            explicitly on the entities of an actual package.

Reply via email to