-
- Downloads
ada: Fix spurious error on call to function returning private in generic
The spurious error is given on a call to a parameterless function returning a private type, present in the body of a generic construct both declared and instantiated in the presence of the full view of the type, because this full view is not properly restored for the instantiation. This is supposed to be handled by the Has_Private_View mechanism, but it is bypassed here because the call to the parameterless function is first parsed as a simple identifier before being later analyzed as a function call. Fixing this first issue uncovered another one, whereby the Has_Private_View flag was not properly set on an operator returning a private type that ends up being later resolved as a function call. Finally a small loophole in Eval_Attribute exposed by the change also needs to be plugged. gcc/ada/ * sem_attr.adb (Eval_Attribute): Add more exceptions to the early return for a prefix which is a nonfrozen generic actual type. * sem_ch12.adb (Copy_Generic_Node): Also check private views in the case of an entity name or operator analyzed as a function call. (Set_Global_Type): Make it a child of Save_Global_References. (Save_References_In_Operator): In the case where the operator has been turned into a function call, call Set_Global_Type on the entity if it is global.
Loading
Please register or sign in to comment