===================================================================
@@ -7020,6 +7020,16 @@
else
return False;
end if;
+
+ -- If the container type is a derived type, the value of the inherited
+ -- aspect is the Reference operation declared for the parent type.
+ -- However, Reference is also a primitive operation of the type, and
+ -- the inherited operation has a different signature. We retrieve the
+ -- right one from the list of primitive operations of the derived type.
+
+ elsif Is_Derived_Type (Etype (Prefix)) then
+ Func := Find_Prim_Op (Etype (Prefix), Chars (Func_Name));
+ Func_Name := New_Occurrence_Of (Func, Loc);
end if;
Assoc := New_List (Relocate_Node (Prefix));