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] Private with-clauses in the context of generic package declarations


In ihe context of a generic package declaration, a private with-clause on a
child unit implies that the implicit with clauses on its parents are private
as well. Previous to this patch, GNAT applied this  rule applied only to non-
eneric units.

Compiling the following must be rejected with:

   gp1.ads:4:23: "Ada" is not visible
   gp1.ads:4:23: non-visible declaration at ada.ads:16

---
private with Ada.Containers.Vectors;  -- NB: private with
generic
   type T1 is tagged private;
   Default_Capacity : Ada.Containers.Count_Type := 2;
   -- What allows 'Ada.Containers.Count_Type' to be visible?
package GP1 is
   type T2 is tagged limited private;
private
   package T1_Vectors is
      new Ada.Containers.Vectors (Natural, T1);
   type T2 is tagged limited record
      Capacity : Ada.Containers.Count_Type := Default_Capacity;
      V        : T1_Vectors.Vector;
   end record;
end GP1;

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

2012-05-15  Ed Schonberg  <schonberg@adacore.com>

	* sem_ch10.adb (Expand_With_Clause): In the context of a generic
	package declaration, a private with-clause on a child unit implies
	that the implicit with clauses on its parents are private as well.

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]