WEDNESDAY, SEPTEMBER 23, 2026
ada
Ada: Ensure discriminant check for constrained view conversion assignment
Adds a missing discriminant check for view conversions involving constrained objects in Ada assignments.
This commit corrects a bug in Ada where a discriminant check was missed during assignment operations involving view conversions of constrained objects. The fix ensures that the actual subtype of the left-hand side (LHS) is correctly built, maintaining type safety for constrained types.
In Details
Ensures Apply_Discriminant_Check in checks.adb correctly builds the LHS subtype for view conversions when the source object is constrained, addressing a gap in discriminant validation.
For Context
- discriminant
- A special field in a tagged record or private type that determines the structure or size of objects of that type. They enable dynamic sizing and variant records.
- view conversion
- In Ada, a way to treat an object of one type as an object of another (often related) type. This can be constrained or unconstrained depending on the target type.