]> git.ipfire.org Git - thirdparty/gcc.git/commit
Ada: Fix use type clause invalidated by use clause in nested package
authorEric Botcazou <ebotcazou@adacore.com>
Mon, 20 Oct 2025 18:48:39 +0000 (20:48 +0200)
committerEric Botcazou <ebotcazou@adacore.com>
Mon, 20 Oct 2025 19:02:05 +0000 (21:02 +0200)
commit2dd0e7ff60e1d8756c7d2c5f99b9dbe541fcf546
tree92be37cc5b36fa9305a43d17558c7dd8080daff1
parentce46ebb26ba20ec5ae10f9e9845427f8e3a324e7
Ada: Fix use type clause invalidated by use clause in nested package

This is an old issue, whereby a use type clause is partially invalidated by
a use clause in a nested package, a variant of PR ada/64869 recently fixed.
The problem occurs only for unusual primitive operators because of a small
oversight in the implementation.  The fix simply aligns this implementation
with the one exercised by PR ada/64869, which is more robust.

gcc/ada/
PR ada/52319
* sem_ch7.adb (Uninstall_Declarations): Use direct test on Nkind
to spot operators.
* sem_ch8.adb (End_Use_Package): Also test the Etype of operators
to spot those which are primitive operators of use-visible types.

gcc/testsuite/
* gnat.dg/use_type3.adb: New test.
gcc/ada/sem_ch7.adb
gcc/ada/sem_ch8.adb
gcc/testsuite/gnat.dg/use_type3.adb [new file with mode: 0644]