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] Full view without preelaborable initialization not flagged in generic


Tested on i686-linux, commited on trunk.

The compiler was failing to detect the error where the full type for a
private type marked with Preelaborable_Initialization does not have
preelaborable initialization in the case where the types occur within
a generic unit (unless the type happens to be frozen before the end
of the generic). This is because declarations in generics are not frozen
by the front end as part of the freezing at the end of the enclosing
scope. The check for preelaborable initialization of full types is
moved from Freeze_Entity to Analyze_Package_Specification, which ensures
that this rule is enforced for types in all package specifications.
A related issue fixed here is that uses of generic actual types in an
instance were not being recognized as having preelaborable initialization
even when the formal type is marked with pragma Preelaborable_Intialization.
This is corrected by applying function Has_Preelaborable_Initialization to
the base type in the case where that function is passed a subtype marked
as Is_Generic_Actual.

2007-09-26  Gary Dismukes  <dismukes@adacore.com>

	* freeze.adb (Freeze_Entity): Remove check for preelaborable
	initialization of a full view. This is moved to
	Analyze_Package_Specification.

	* sem_ch7.adb (Analyze_Package_Specification): Add check for
	preelaborable initialization of a full view in entity loop.
	(Uninstall_Declarations): If entity is a use-visible compilation unit,
	its child units are use-visible only if they are visible child units.

	* sem_util.adb (Is_Preelaborable_Expression): New function to determine
	whether an expression can be used within a type declaration that
	requires preelaborable init.
	(Check_Components): Replace inline code that does partial checking for
	preelaborable default expressions with call to
	Is_Preelaborable_Expression.
	(Has_Preelaborable_Initialization): In the case of a generic actual
	subtype, (that is, Is_Generic_Actual is True), return the result of
	applying Has_Preelaborable_Initialization to the generic actual's base
	type.

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]