WEDNESDAY, SEPTEMBER 23, 2026
ada
Ada: Fix discriminant handling in derived private types
Correctly propagates discriminant and constrained status when deriving constrained private types with defaulted discriminants.
This change fixes an issue in Ada where the Has_Constrained_Partial_View flag was not correctly inherited when deriving constrained private types that had defaulted discriminants. The fix ensures that both the partial and full views of derived types correctly inherit this flag from their parent types, maintaining correct type behavior.
In Details
Fixes discriminant and constrained-partial-view flag propagation in Build_Derived_Private_Type and Build_Derived_Record_Type within sem_ch3.adb for derived private types with defaulted discriminants.
For Context
- private type
- An Ada type whose internal structure is hidden from users of the type, providing data encapsulation. Its operations are defined in a private extension of a tagged type.
- defaulted discriminant
- A discriminant for a record type or private type that has a default value, allowing objects of that type to be created without explicitly providing a value for the discriminant.