The recently added extension of allowing prefixed-call notation for
primitives of untagged types doesn't handle certain cases of prefixed
calls where the prefix of the call is an overloaded function call.
Specifically, this can occur when the result of some overloadings of the
function have results of a predefined type (such as Integer or Boolean).
Predefined types don't have an Direct_Primitive_Operations Elist, and we
have to avoid retrieving that list and testing for a prefixed call for
call-prefix interpretations where the list isn't present for the type.

Tested on x86_64-pc-linux-gnu, committed on trunk

gcc/ada/

        * sem_ch4.adb (Try_One_Prefix_Interpretation): Augment test of
        "not Extensions_Allowed" with test for absence of Obj_Type's
        primitive operations Elist, as an additional condition for early
        return from this procedure.
diff --git a/gcc/ada/sem_ch4.adb b/gcc/ada/sem_ch4.adb
--- a/gcc/ada/sem_ch4.adb
+++ b/gcc/ada/sem_ch4.adb
@@ -9558,9 +9558,13 @@ package body Sem_Ch4 is
 
          --  Extension feature: Calls with prefixed views are also supported
          --  for untagged types, so skip the early return when extensions are
-         --  enabled.
+         --  enabled, unless the type doesn't have a primitive operations list
+         --  (such as in the case of predefined types).
 
-         if (not Is_Tagged_Type (Obj_Type) and then not Extensions_Allowed)
+         if (not Is_Tagged_Type (Obj_Type)
+              and then
+                (not Extensions_Allowed
+                  or else not Present (Primitive_Operations (Obj_Type))))
            or else Is_Incomplete_Type (Obj_Type)
          then
             Obj_Type := Prev_Obj_Type;


Reply via email to