===================================================================
@@ -8860,7 +8860,7 @@
while Present (Hom) loop
if Ekind_In (Hom, E_Procedure, E_Function)
and then (not Is_Hidden (Hom) or else In_Instance)
- and then Scope (Hom) = Scope (Anc_Type)
+ and then Scope (Hom) = Scope (Base_Type (Anc_Type))
and then Present (First_Formal (Hom))
and then
(Base_Type (Etype (First_Formal (Hom))) = Cls_Type
@@ -8921,8 +8921,13 @@
Success => Success,
Skip_First => True);
+ -- The same operation may be encountered on two homonym
+ -- traversals, before and after looking at interfaces.
+ -- Check for this case before reporting a real ambiguity.
+
if Present (Valid_Candidate (Success, Call_Node, Hom))
and then Nkind (Call_Node) /= N_Function_Call
+ and then Hom /= Matching_Op
then
Error_Msg_NE ("ambiguous call to&", N, Hom);
Report_Ambiguity (Matching_Op);
===================================================================
@@ -0,0 +1,8 @@
+with Ada.Text_IO; use Ada.Text_IO;
+with Class_Wide3_Pkg; use Class_Wide3_Pkg;
+
+procedure Class_Wide3 is
+ DC : Disc_Child := (N => 1, I => 3, J => 5);
+begin
+ DC.Put_Line;
+end Class_Wide3;
===================================================================
@@ -0,0 +1,16 @@
+package Class_Wide3_Pkg is
+
+ type Iface is interface;
+ type Iface_Ptr is access all Iface'Class;
+
+ procedure Put_Line (I : Iface'Class);
+
+ type Root is tagged record
+ I : Integer;
+ end record;
+
+ type Disc_Child (N : Integer) is new Root and Iface with record
+ J : Integer;
+ end record;
+
+end Class_Wide3_Pkg;