===================================================================
@@ -10094,7 +10094,11 @@
-- elaboration, because only the access type is needed in the
-- initialization procedure.
- Set_Ekind (Def_Id, Ekind (T));
+ if Ekind (T) = E_Incomplete_Type then
+ Set_Ekind (Def_Id, E_Incomplete_Subtype);
+ else
+ Set_Ekind (Def_Id, Ekind (T));
+ end if;
if For_Access and then Within_Init_Proc then
null;
@@ -13629,15 +13633,9 @@
procedure Fixup_Bad_Constraint is
begin
- -- Set a reasonable Ekind for the entity. For an incomplete type,
- -- we can't do much, but for other types, we can set the proper
- -- corresponding subtype kind.
+ -- Set a reasonable Ekind for the entity, including incomplete types.
- if Ekind (T) = E_Incomplete_Type then
- Set_Ekind (Def_Id, Ekind (T));
- else
- Set_Ekind (Def_Id, Subtype_Kind (Ekind (T)));
- end if;
+ Set_Ekind (Def_Id, Subtype_Kind (Ekind (T)));
-- Set Etype to the known type, to reduce chances of cascaded errors
@@ -20802,7 +20800,9 @@
-- Ada 2005 (AI-412): Transform a regular incomplete subtype into a
-- corresponding subtype of the full view.
- elsif Ekind (Priv_Dep) = E_Incomplete_Subtype then
+ elsif Ekind (Priv_Dep) = E_Incomplete_Subtype
+ and then Comes_From_Source (Priv_Dep)
+ then
Set_Subtype_Indication
(Parent (Priv_Dep), New_Occurrence_Of (Full_T, Sloc (Priv_Dep)));
Set_Etype (Priv_Dep, Full_T);
===================================================================
@@ -1441,11 +1441,14 @@
-- Check on incomplete types
- -- AI05-0213: A formal incomplete type has no completion
+ -- AI05-0213: A formal incomplete type has no completion,
+ -- and neither does the corresponding subtype in an instance.
- if Ekind (E) = E_Incomplete_Type
+ if Is_Incomplete_Type (E)
and then No (Full_View (E))
and then not Is_Generic_Type (E)
+ and then not From_Limited_With (E)
+ and then not Is_Generic_Actual_Type (E)
then
Error_Msg_N ("no declaration in visible part for incomplete}", E);
end if;
===================================================================
@@ -7151,13 +7151,13 @@
begin
Desig_Type := Directly_Designated_Type (Id);
- if Ekind (Desig_Type) = E_Incomplete_Type
+ if Is_Incomplete_Type (Desig_Type)
and then Present (Full_View (Desig_Type))
then
return Full_View (Desig_Type);
elsif Is_Class_Wide_Type (Desig_Type)
- and then Ekind (Etype (Desig_Type)) = E_Incomplete_Type
+ and then Is_Incomplete_Type (Etype (Desig_Type))
and then Present (Full_View (Etype (Desig_Type)))
and then Present (Class_Wide_Type (Full_View (Etype (Desig_Type))))
then
@@ -7364,11 +7364,11 @@
function Get_Full_View (T : Entity_Id) return Entity_Id is
begin
- if Ekind (T) = E_Incomplete_Type and then Present (Full_View (T)) then
+ if Is_Incomplete_Type (T) and then Present (Full_View (T)) then
return Full_View (T);
elsif Is_Class_Wide_Type (T)
- and then Ekind (Root_Type (T)) = E_Incomplete_Type
+ and then Is_Incomplete_Type (Root_Type (T))
and then Present (Full_View (Root_Type (T)))
then
return Class_Wide_Type (Full_View (Root_Type (T)));
@@ -7800,7 +7800,7 @@
Entity_Is_Base_Type : constant array (Entity_Kind) of Boolean :=
(E_Enumeration_Subtype |
- E_Incomplete_Type |
+ E_Incomplete_Subtype |
E_Signed_Integer_Subtype |
E_Modular_Integer_Subtype |
E_Floating_Point_Subtype |
@@ -9174,6 +9174,9 @@
when Enumeration_Kind =>
Kind := E_Enumeration_Subtype;
+ when E_Incomplete_Type =>
+ Kind := E_Incomplete_Subtype;
+
when Float_Kind =>
Kind := E_Floating_Point_Subtype;