Fix two bugs uncovered by a recent ACATS test
C3A1005: a freezing problem
and a case where a user-defined equality function for an incomplete type
was incorrectly hidden from use-clause visibility by the "corresponding"
predefined op (which doesn't actually exist).
gcc/ada/ChangeLog:
* sem_ch6.adb (Analyze_Subprogram_Body_Helper): Don't freeze here
if Has_Delayed_Freeze returns True.
* sem_type.adb (Valid_Equality_Arg): Treat an incomplete type like
a limited type because neither has an implicitly-defined equality
primitive.
(Covers): If either argument is an incomplete type
whose full view is available, then look through to the full view.
* sem_res.adb (Resolve_Actuals): If the actual parameter type is
complete and the formal parameter type is not, then update the
formal parameter type to use the complete view.
Set_Is_Public (Body_Id, False);
end if;
- Freeze_Before (N, Body_Id);
+ if not Has_Delayed_Freeze (Body_Id) then
+ Freeze_Before (N, Body_Id);
+ end if;
end if;
if Nkind (N) /= N_Subprogram_Body_Stub then
A_Typ := Etype (A);
F_Typ := Etype (F);
+ -- If A_Typ is complete and F_Typ is not, then adjust F_Typ
+
+ if Ekind (F_Typ) = E_Incomplete_Type
+ and then Present (Full_View (F_Typ))
+ and then not Is_Incomplete_Type (A_Typ)
+ then
+ F_Typ := Full_View (F_Typ);
+ end if;
+
-- An actual cannot be an untagged formal incomplete type
if Ekind (A_Typ) = E_Incomplete_Type
return Has_Non_Limited_View (T2)
and then Covers (T1, Get_Full_View (Non_Limited_View (T2)));
+ -- Coverage for incomplete types
+
+ elsif Ekind (T1) = E_Incomplete_Type
+ and then Present (Full_View (T1))
+ then
+ return Covers (Full_View (T1), T2);
+
+ elsif Ekind (T2) = E_Incomplete_Type
+ and then Present (Full_View (T2))
+ then
+ return Covers (T1, Full_View (T2));
+
-- Ada 2005 (AI-412): Coverage for regular incomplete subtypes
elsif Ekind (T1) = E_Incomplete_Subtype then
if Is_Anonymous_Access_Type (T) then
return Ada_Version >= Ada_2005;
+ elsif Is_Incomplete_Type (T) then
+ return False;
+
elsif not Is_Limited_Type (T) then
return True;