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] Deferred constants of an anonymous access type.


Tested on i686-linux, committed on trunk

Anonymous access types are itypes that are elaborated at the first point of use.
For a deferred constant of an anonymous access type, the type is created for
the incomplete declaration, but the first use may only appear in a scope nested
in the package body (e.g. within a function that implements the singleton
design pattern). The back-end cannot elaborate an itype if the point of use
is not in the scope of the itype. Therefore we must create an itype reference
after the point of declaration, to force elaboration in the proper scope.
Even though the problem only arises for deferred constants, this patch creates
the itype for all object declarations of an anonymous access type, to make the
treatment more uniform.

See gnat.dg/forward_anon.adb

2008-03-26  Ed Schonberg  <schonberg@adacore.com>

	* sem_ch3.adb (Access_Definition): If the access type is the return
	result of a protected function, create an itype reference for it
	because usage will be in an inner scope from the point of declaration.
	(Build_Derived_Record_Type): Inherit Reverse_Bit_Order and
	OK_To_Reorder_Components.
	(Make_Index): If an overloaded range includes a universal integer
	interpretation, resolve to Standard.Integer.
	(Analyze_Subtype_Indication): Copy Convention to subtype
	(Check_Abstract_Interfaces): Complete semantic checks on the legality of
	limited an synchronized progenitors in type declaration and private
	extension declarations.

	* exp_ch13.adb (Expand_N_Freeze_Entity): If the scope of the entity is a
	protected subprogram body, determine proper scope from subprogram
	declaration.

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]