[gcc r15-11449] Ada: Fix bogus error for 'Unrestricted_Access of overloaded subprogram

Eric Botcazou via Gcc-cvs <[email protected]> Sun, 2 Aug 2026 12:13:56 +0000 (GMT)
Newsgroups gmane.comp.gcc.cvs
Message-ID <[email protected]>
https://gcc.gnu.org/g:e28e7daf10beb0b03dac3d4c24cf374e2d8e9b70

commit r15-11449-ge28e7daf10beb0b03dac3d4c24cf374e2d8e9b70
Author: Eric Botcazou <[email protected]>
Date:   Thu Jul 30 18:29:51 2026 +0200

    Ada: Fix bogus error for 'Unrestricted_Access of overloaded subprogram
    
    This plugs an old loophole in Analyze_Attribute for the handling of the
    GNAT specific Unrestricted_Access attribute.
    
    gcc/ada/
            PR ada/126482
            * sem_attr.adb (Analyze_Attribute): Treat Unrestricted_Access like
            [Unchecked_]Access when it comes to the overloading of the prefix.

Diff:
---
 gcc/ada/sem_attr.adb | 1 +
 1 file changed, 1 insertion(+)

diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb
index 96f82ad1b5f7..a4dde52570fb 100644
--- a/gcc/ada/sem_attr.adb
+++ b/gcc/ada/sem_attr.adb
@@ -3359,6 +3359,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