[Ada] Fix bogus error for 'Unrestricted_Access of overloaded subprogram

Eric Botcazou <[email protected]>
Newsgroups gmane.comp.gcc.patches
Message-ID <6291169.lOV4Wx5bFT@arcturus>
This plugs an old loophole in Analyze_Attribute for the handling of the GNAT 
specific Unrestricted_Access attribute.

Tested on x86-64/Linux, applied on the mainline and 16 branch.


2026-07-30  Eric Botcazou  <[email protected]>

	PR ada/126482
	* sem_attr.adb (Analyze_Attribute): Treat Unrestricted_Access like
	[Unchecked_]Access when it comes to the overloading of the prefix.

-- 
Eric Botcazou
pr126482.diff (text/x-patch, 550 B)
diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb
index 7ef0145e872..7180ab81314 100644
--- a/gcc/ada/sem_attr.adb
+++ b/gcc/ada/sem_attr.adb
@@ -3527,6 +3527,7 @@ package body Sem_Attr is
         and then Aname /= Name_Code_Address
         and then Aname /= Name_Result
         and then Aname /= Name_Unchecked_Access
+        and then Aname /= Name_Unrestricted_Access
       then
          --  The prefix must be resolvable by itself, without reference to the
          --  attribute. One case that requires special handling is a prefix
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.