and then Ada_Version >= Ada_2005
                  and then not Comes_From_Source (E)
                  and then Has_Controlling_Result (E)
-                 and then Is_Null_Extension (Etype (E))
+                 and then (not Is_Class_Wide_Type (Etype (E))
+                            and then Is_Null_Extension (Etype (E)))
                  and then Comes_From_Source (Spec)
                then
                   Set_Has_Completion (E, False);
 
             function Overrides_Private_Part_Op return Boolean is
                Over_Decl : constant Node_Id :=
-                             Unit_Declaration_Node (Overridden_Operation (S));
+                             Unit_Declaration_Node
+                               (Ultimate_Alias (Overridden_Operation (S)));
                Subp_Decl : constant Node_Id := Unit_Declaration_Node (S);
 
             begin
 
 
          Set_Etype (Call, Etype (Callee));
 
-         if Base_Type (Etype (Call)) /= Base_Type (Typ) then
+         --  Conversion not needed if the result type of the call is class-wide
+         --  or if the result type matches the context type.
+
+         if not Is_Class_Wide_Type (Typ)
+           and then Base_Type (Etype (Call)) /= Base_Type (Typ)
+         then
             --  Conversion may be needed in case of an inherited
             --  aspect of a derived type. For a null extension, we
             --  use a null extension aggregate instead because the
 
       Type_Decl : Node_Id;
       Type_Def  : Node_Id;
    begin
+      pragma Assert (not Is_Class_Wide_Type (T));
+
       if Ignore_Privacy then
          Type_Decl := Parent (Underlying_Type (Base_Type (T)));
       else
         := Underlying_Type (Base_Type (Ancestor));
       Descendant_Type : Entity_Id := Underlying_Type (Base_Type (Descendant));
    begin
+      pragma Assert (not Is_Class_Wide_Type (Descendant));
+      pragma Assert (not Is_Class_Wide_Type (Ancestor));
       pragma Assert (Descendant_Type /= Ancestor_Type);
+
       while Descendant_Type /= Ancestor_Type loop
          if not Is_Null_Extension
                   (Descendant_Type, Ignore_Privacy => True)
 
    --  Given a tagged type, returns True if argument is a type extension
    --  that introduces no new components (discriminant or nondiscriminant).
    --  Ignore_Privacy should be True for use in implementing dynamic semantics.
+   --  Cannot be called with class-wide types.
 
    function Is_Null_Extension_Of
      (Descendant, Ancestor : Entity_Id) return Boolean;
    --  Given two tagged types, the first a descendant of the second,
    --  returns True if every component of Descendant is inherited
    --  (directly or indirectly) from Ancestor. Privacy is ignored.
+   --  Cannot be called with class-wide types.
 
    function Is_Null_Record_Definition (Record_Def : Node_Id) return Boolean;
    --  Returns True for an N_Record_Definition node that has no user-defined