This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Ada] Handling of discriminated components with a box in record aggregates


In Ada2005, if a record component is given a box association in an aggregate
for an enclosing type, and the component is of a discriminated type, we create
a subaggregate for it with explicit values for the discriminants, and box
associations for the remaining components. We retrieve values of discriminants
from the discriminant constraint of the corresponding subtype. However, the
constraint may be given by the discriminants of the enclosing record, whose
values must be present in the enclosing aggregate itself. We must scan the
list of previous associations of the aggregate to retrieve the current value
of the discriminant, and use this current value in the subaggregate.

See gnat.dg/discr_test2.adb

2007-09-10  Ed Schonberg  <schonberg@adacore.com>

	* sem_aggr.adb (Build_Record_Aggr_Code): If an aggregate component is
	given a box association, the type of the component is discriminated,
	and the value of the discriminant is the discriminant of the enclosing
	type, retrieve its value from the aggregate itself, where it must have
	been supplied.
	Update to GPLv3.

	* sem_ch4.adb (Analyze_One_Call): Further refinement to previous fix,
	to remove other spurious ambiguities on arithmetic operations involving
	literals and addresses, on systems where Address is a visible integer
	type, when the operator is called in functional notation.
	(Try_Primitive_Operation): Within an instance, a call in prefixed form
	is legal when the types match, even if the operation is currently
	hidden.
	Update to GPLv3.

Attachment: difs
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]