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] Another freezing issue on expression function in nested package


This patch totally disables the freezing of an expression function at the
point its body is analyzed, as well the freezing of all the types that are
not yet frozen, in order to support more cases where the profile contains
a type which depends on a private type that is declared in an open scope
and does not yet have a completion.

The following package must compile quietly:

package P is

   type Forward_Cursor is private;

   package Nested is

      type Cursor is access Forward_Cursor;

      type Rec is record
         C : Forward_Cursor;
      end record;

      function Element (R : Rec; Current : Cursor) return Cursor is (Current);

   end Nested;

private

   type Forward_Cursor is null record;

end P;

Tested on x86_64-pc-linux-gnu, committed on trunk

2017-09-11  Eric Botcazou  <ebotcazou@adacore.com>

	* freeze.adb (Has_Incomplete_Compoent): Delete.
	(Freeze_Profile):
	Do not inhibit the freezing of the profile of an expression
	function here.
	(Freeze_Subprogram): Do not re-create extra formals.
	* sem_ch6.adb (Analyze_Expression_Function): Always
	pre-analyze the expression if the function is not a completion.
	(Analyze_Subprogram_Body_Helper): For the body generated
	from an expression function that is not a completion, do
	not freeze the profile and temporary mask the types declared
	outside the expression that are not yet frozen.
	* sem_res.adb (Rewrite_Renamed_Operator): Also bail out if invoked
	during the pre-analysis of an expression function.

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]