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] Spurious error on predicate of local private type.


This patch fixes a spurious error on a predicate specification for a type
declared in a local package, when an object declaration that references that
type appears outside of the package.

The following must compile quietly:

---
procedure Pred_Scope is

   package P is
      Local : Boolean := False;
      type T is private with Dynamic_Predicate => Local;
      subtype T2 is Integer range 1 .. 10 with Dynamic_Predicate => Local;
   private
      type T is new Integer;
   end;

   Dummy1 : P.T;
   Dummy2 : P.T2;

begin
   null;
end;

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

2017-04-25  Ed Schonberg  <schonberg@adacore.com>

	* sem_util.adb, sem_util.ads (From_Nested_Package): New predicate
	to determine whether a type is declared in a local package that
	has not yet been frozen.
	* freeze.adb (Freeze_Before): Use new predicate to determine
	whether a local package must be installed on the scope stack
	in order to evaluate in the proper scope actions generated by
	aspect specifications, such as Predicate
	* sem_ch13.adb: Simplify code in Analyze_Aspects_At_Freeze_Point
	using new predicate.

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]