Skip to content
Snippets Groups Projects
Commit ad09934f authored by Eric Botcazou's avatar Eric Botcazou Committed by Marc Poulhiès
Browse files

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.
parent 54dd56f5
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment