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

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

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

commit r16-5100-geebee8f21d727231cf3db837684cb6cafb066fb0
Author: Eric Botcazou <[email protected]>
Date:   Sat Nov 8 19:15:46 2025 +0100

    Ada: Fix bogus error on limited with clause and private parent package

    The implementation of the 10.1.2(8/2-11/2) subclauses that establish rules
    for the legality of "with" clauses of private child units is done
separately
    for regular "with" clauses (in Check_Private_Child_Unit) and for limited
    "with" clauses (in Check_Private_Limited_Withed_Unit).  The testcase, which
    contains the regular and the "limited" version of the same pattern,
exhibits
    a disagreement between them; the former implementation is correct and the
    latter is wrong in this case.

    The patch fixes the problem and also cleans up the latter implementation by
    aligning it with the former as much as possible.

    gcc/ada/
            PR ada/34374
            * sem_ch10.adb (Check_Private_Limited_Withed_Unit): Use a separate
            variable for the private child unit, streamline the loop locating
            the nearest private ancestor, fix a too early termination of the
            loop traversing the ancestor of the current unit, and use the same
            privacy test as Check_Private_Child_Unit.

    gcc/testsuite/
            * gnat.dg/specs/limited_with4.ads: Rename to...
            * gnat.dg/specs/limited_with1.ads: ...this.
            * gnat.dg/specs/limited_with4_pkg.ads: Rename to...
            * gnat.dg/specs/limited_with1_pkg.ads: ...this.
            * gnat.dg/specs/limited_with2-child1.ads: New test.
            * gnat.dg/specs/limited_with2-child2.ads: Likewise.
            * gnat.dg/specs/limited_with2.ads: New helper.

Reply via email to