diff --git a/gcc/ada/sem_ch4.adb b/gcc/ada/sem_ch4.adb
index 18b3a4fc22f53f62bfe5df1b29a7c786abeeadd5..94e434298140c8e685ae550d95c7f814ae4af05c 100644
--- a/gcc/ada/sem_ch4.adb
+++ b/gcc/ada/sem_ch4.adb
@@ -10498,6 +10498,11 @@ package body Sem_Ch4 is
       Set_Etype (Subprog, Any_Type);
       Set_Parent (New_Call_Node, Parent (Node_To_Replace));
 
+      --  Perform the analysis searching for a candidate with Report_Error
+      --  set to False (see above); if no candidate interpretation matches
+      --  the context, this analysis will be redone with Report_Error set
+      --  to True to provide additional information.
+
       if not Is_Overloaded (Obj) then
          Try_One_Prefix_Interpretation (Obj_Type);
 
@@ -10537,18 +10542,22 @@ package body Sem_Ch4 is
 
          if All_Errors_Mode then
             Report_Error := True;
-            if Try_Primitive_Operation
-                 (Call_Node       => New_Call_Node,
-                  Node_To_Replace => Node_To_Replace)
 
-              or else
-                Try_Class_Wide_Operation
-                  (Call_Node       => New_Call_Node,
-                   Node_To_Replace => Node_To_Replace)
-            then
-               null;
-            end if;
+            if not Is_Overloaded (Obj) then
+               Try_One_Prefix_Interpretation (Obj_Type);
 
+            else
+               declare
+                  I  : Interp_Index;
+                  It : Interp;
+               begin
+                  Get_First_Interp (Obj, I, It);
+                  while Present (It.Nam) loop
+                     Try_One_Prefix_Interpretation (It.Typ);
+                     Get_Next_Interp (I, It);
+                  end loop;
+               end;
+            end if;
          else
             Analyze_One_Call
               (N          => New_Call_Node,