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 --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb
index d4bfd64..4961c7a 100644
--- a/gcc/ada/sem_util.adb
+++ b/gcc/ada/sem_util.adb
@@ -22755,7 +22755,8 @@
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))
@@ -22763,7 +22764,9 @@
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