[Ada] Fix regression in visibility for nested use_type_clauses

Eric Botcazou botcazou@adacore.com
Fri Jan 30 18:11:40 GMT 2026


From: Gary Dismukes <dismukes@adacore.com>

An earlier fix for wrong handling of visibility when a use_type_clause
with "all" occurs within a nested scope when there's a use_type_clause
in an enclosing scope without "all" was incorrect and led to primitives
being visible in a later nested scope that has a use_type_clause with
"all" for the same type.  We now properly restore Current_Use_Clause
to refer to the outer use_type_clause when ending the scope of nested
use_type_clauses.
        
Tested on x86-64/Linux, applied on the mainline.


gcc/ada/ChangeLog:

	* sem_ch8.adb (End_Use_Type): Remove test of Prev_Use_Clause as
	as a condition for resetting In_Use and Current_Use_Clause, and
	change setting of that flag and field based on Prev_Use_Clause
	rather than setting them to Empty. Revise preceding comment.

-- 
Eric Botcazou
-------------- next part --------------
A non-text attachment was scrubbed...
Name: p.diff
Type: text/x-patch
Size: 1668 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-patches/attachments/20260130/0cd19667/attachment.bin>


More information about the Gcc-patches mailing list