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

commit r16-3708-ge7c526a40c134353f425965a2a595e572ebfdcf7
Author: Javier Miranda <[email protected]>
Date:   Thu Aug 7 09:42:15 2025 +0000

    ada: Spurious error on generalized prefix notation
    
    The compiler reports a spurious error when a primitive function of
    an untagged type that returns an array type is invoked using the
    prefix notation, and the sources are compiled with language
    extensions enabled.
    
    gcc/ada/ChangeLog:
    
            * sem_util.adb (Needs_One_Actual): Add support for untagged record
            types when the sources are compiled with Core Extensions allowed.

Diff:
---
 gcc/ada/sem_util.adb | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb
index aeae589dcad4..b3b6dec55151 100644
--- a/gcc/ada/sem_util.adb
+++ b/gcc/ada/sem_util.adb
@@ -23154,7 +23154,8 @@ package body Sem_Util is
    begin
       --  Ada 2005 or later, and formals present. The first formal must be
       --  of a type that supports prefix notation: a controlling argument,
-      --  a class-wide type, or an access to such.
+      --  a class-wide type, an access to such, or an untagged record type
+      --  (when compiling with Core_Extensions allowed).
 
       if Ada_Version >= Ada_2005
         and then Present (First_Formal (E))
@@ -23162,7 +23163,9 @@ package body Sem_Util is
         and then
           (Is_Controlling_Formal (First_Formal (E))
             or else Is_Class_Wide_Type (Etype (First_Formal (E)))
-            or else Is_Anonymous_Access_Type (Etype (First_Formal (E))))
+            or else Is_Anonymous_Access_Type (Etype (First_Formal (E)))
+            or else (Core_Extensions_Allowed
+                       and then Is_Record_Type (Etype (First_Formal (E)))))
       then
          Formal := Next_Formal (First_Formal (E));
          while Present (Formal) loop

Reply via email to