gcc/ada/
* exp_ch5.adb (Find_Component): If the target type is a derived
record type and the required component is a discriminant that is
renamed in the derived type declaration, use the name of the
original discriminant to locate the intended target component.
while Present (C) loop
if Chars (C) = Chars (Comp) then
return C;
+
+ -- The component may be a renamed discriminant, in
+ -- which case check against the name of the original
+ -- discriminant of the parent type.
+
+ elsif Is_Derived_Type (Scope (Comp))
+ and then Ekind (Comp) = E_Discriminant
+ and then Present (Corresponding_Discriminant (Comp))
+ and then
+ Chars (C) = Chars (Corresponding_Discriminant (Comp))
+ then
+ return C;
end if;
Next_Entity (C);