Error_Msg_NE ("ambiguous call to&", N, Hom);
Report_Ambiguity (Matching_Op);
Report_Ambiguity (Hom);
+ Check_Ambiguous_Aggregate (New_Call_Node);
Error := True;
return;
end if;
Error_Msg_NE ("ambiguous call to&", N, Prim_Op);
Report_Ambiguity (Matching_Op);
Report_Ambiguity (Prim_Op);
+ Check_Ambiguous_Aggregate (Call_Node);
return True;
end if;
end if;
then
Error_Msg_NE ("ambiguous call to&", Arg, Name (Arg));
- -- Could use comments on what is going on here???
+ -- Examine possible interpretations, and adapt the message
+ -- for inherited subprograms declared by a type derivation.
Get_First_Interp (Name (Arg), I, It);
while Present (It.Nam) loop
Get_Next_Interp (I, It);
end loop;
end if;
+
+ -- Additional message and hint if the ambiguity involves an Ada2020
+ -- container aggregate.
+
+ Check_Ambiguous_Aggregate (N);
end Report_Ambiguous_Argument;
-----------------------
end if;
end Cannot_Raise_Constraint_Error;
+ -------------------------------
+ -- Check_Ambiguous_Aggregate --
+ -------------------------------
+
+ procedure Check_Ambiguous_Aggregate (Call : Node_Id) is
+ Actual : Node_Id;
+
+ begin
+ if Extensions_Allowed then
+ Actual := First_Actual (Call);
+ while Present (Actual) loop
+ if Nkind (Actual) = N_Aggregate then
+ Error_Msg_N
+ ("\add type qualification to aggregate actual", Actual);
+ exit;
+ end if;
+ Next_Actual (Actual);
+ end loop;
+ end if;
+ end Check_Ambiguous_Aggregate;
+
-----------------------------------------
-- Check_Dynamically_Tagged_Expression --
-----------------------------------------
-- not necessarily mean that CE could be raised, but a response of True
-- means that for sure CE cannot be raised.
+ procedure Check_Ambiguous_Aggregate (Call : Node_Id);
+ -- Additional information on an ambiguous call in Ada_2020 when a
+ -- subprogram call has an actual that is an aggregate, and the
+ -- presence of container aggregates (or types with the correwponding
+ -- aspect) provides an additional interpretation. Message indicates
+ -- that an aggregate actual should carry a type qualification.
+
procedure Check_Dynamically_Tagged_Expression
(Expr : Node_Id;
Typ : Entity_Id;