-- E is some record type. This routine computes E's Stored_Constraint
-- from its Discriminant_Constraint.
+ procedure Diagnose_Interface (N : Node_Id; E : Entity_Id);
+ -- Check that an entity in a list of progenitors is an interface,
+ -- emit error otherwise.
+
-----------------------
-- Access_Definition --
-----------------------
while Present (Intf) loop
T := Find_Type_Of_Subtype_Indic (Intf);
- if not Is_Interface (T) then
- Error_Msg_NE ("(Ada 2005) & must be an interface", Intf, T);
- end if;
-
+ Diagnose_Interface (Intf, T);
Next (Intf);
end loop;
end;
Iface_Def := Type_Definition (Parent_Node);
if not Is_Interface (Iface_Typ) then
- Error_Msg_NE ("(Ada 2005) & must be an interface",
- Iface, Iface_Typ);
+ Diagnose_Interface (Iface, Iface_Typ);
else
Check_Ifaces (Iface_Def, Iface);
Iface_Def := Type_Definition (Parent_Node);
if not Is_Interface (Iface_Typ) then
- Error_Msg_NE ("(Ada 2005) & must be an interface",
- Iface, Iface_Typ);
+ Diagnose_Interface (Iface, Iface_Typ);
else
-- "The declaration of a specific descendant of an interface
if Interface_Present (Def) then
if not Is_Interface (Parent_Type) then
- Error_Msg_NE
- ("(Ada 2005) & must be an interface", Indic, Parent_Type);
+ Diagnose_Interface (Indic, Parent_Type);
else
Parent_Node := Parent (Base_Type (Parent_Type));
T := Find_Type_Of_Subtype_Indic (Intf);
if not Is_Interface (T) then
- Error_Msg_NE ("(Ada 2005) & must be an interface", Intf, T);
+ Diagnose_Interface (Intf, T);
-- Check the rules of 3.9.4(12/2) and 7.5(2/2) that disallow
-- a limited type from having a nonlimited progenitor.
end if;
end Derived_Type_Declaration;
+ ------------------------
+ -- Diagnose_Interface --
+ ------------------------
+
+ procedure Diagnose_Interface (N : Node_Id; E : Entity_Id) is
+ begin
+ if not Is_Interface (E)
+ and then E /= Any_Type
+ then
+ Error_Msg_NE ("(Ada 2005) & must be an interface", N, E);
+ end if;
+ end Diagnose_Interface;
+
----------------------------------
-- Enumeration_Type_Declaration --
----------------------------------