===================================================================
@@ -1378,6 +1378,16 @@
("full view of & does not have preelaborable initialization", E);
end if;
+ -- An invariant may appear on a full view of a type
+
+ if Is_Type (E)
+ and then Has_Private_Declaration (E)
+ and then Nkind (Parent (E)) = N_Full_Type_Declaration
+ and then Has_Aspects (Parent (E))
+ then
+ Build_Invariant_Procedure (E, N);
+ end if;
+
Next_Entity (E);
end loop;
===================================================================
@@ -4738,6 +4738,14 @@
-- (this is an error that will be caught elsewhere);
Append_To (Private_Decls, PBody);
+
+ -- If the invariant appears on the full view of a type, the
+ -- analysis of the private part is complete, and we must
+ -- analyze the new body explicitly.
+
+ if In_Private_Part (Current_Scope) then
+ Analyze (PBody);
+ end if;
end if;
end if;
end Build_Invariant_Procedure;