Private type entities have Is_Constrained set when they have no
discriminants and no unknown discriminants; it is now set slightly
later, but simpler (this change could only affect Process_Discriminants,
but this flag should not be needed there).
Also, we now reuse this flag to detect private types with discriminants.
Code cleanup; behavior is unaffected.
gcc/ada/
* sem_ch7.adb (New_Private_Type): Simplify setting of
Is_Constrained flag.
* sem_prag.adb (Is_Unconstrained_Or_Tagged_Item): Simplify
detection of private types with no discriminant.
Set_Is_First_Subtype (Id);
Reinit_Size_Align (Id);
- Set_Is_Constrained (Id,
- No (Discriminant_Specifications (N))
- and then not Unknown_Discriminants_Present (N));
-
-- Set tagged flag before processing discriminants, to catch illegal
-- usage.
elsif Unknown_Discriminants_Present (N) then
Set_Has_Unknown_Discriminants (Id);
+
+ else
+ Set_Is_Constrained (Id);
end if;
Set_Private_Dependents (Id, New_Elmt_List);
return Has_Discriminants (Typ) and then not Is_Constrained (Typ);
elsif Is_Private_Type (Typ) then
- return Has_Discriminants (Typ)
- or else Has_Unknown_Discriminants (Typ);
+ return not Is_Constrained (Typ);
else
return False;