function Valid_Ancestor_Type return Boolean;
-- Verify that the type of the ancestor part is a non-private ancestor
- -- of the expected type.
+ -- of the expected type, which must be a type extension.
----------------------------
-- Valid_Limited_Ancestor --
Imm_Type := Etype (Base_Type (Imm_Type));
end loop;
- if Etype (Imm_Type) /= Base_Type (A_Type)
- or else Base_Type (Typ) = Base_Type (A_Type)
+ if not Is_Derived_Type (Base_Type (Typ))
+ or else Etype (Imm_Type) /= Base_Type (A_Type)
then
Error_Msg_NE ("expect ancestor type of &", A, Typ);
return False;