aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-object-size.c
diff options
context:
space:
mode:
authorEd Schonberg <schonberg@adacore.com>2019-07-04 08:07:00 +0000
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>2019-07-04 08:07:00 +0000
commitcb2ce45bfeca0a99aba1136d02dcb9ae491e477d (patch)
tree461648ed8fb112ace998cd91751bb9e97600b629 /gcc/tree-object-size.c
parent0839ffce2ddfe5aa3fb4b7cd8b51610f4c116bcb (diff)
downloadgcc-cb2ce45bfeca0a99aba1136d02dcb9ae491e477d.zip
gcc-cb2ce45bfeca0a99aba1136d02dcb9ae491e477d.tar.gz
gcc-cb2ce45bfeca0a99aba1136d02dcb9ae491e477d.tar.bz2
[Ada] Spurious error on instantiation and limited_with_clause
This patch fixes a spurious error during the construction of an instance body in the inlining phase of the frontend, when the package declaration for the main unit has a limited_with_clause on some unit P, and the main unit itself does not have a corresponding regular with_clause, but some other unit in the context has with_clause that has compiled P. P must be removed from visibility to prevent conflicts with homonyms in the generic body to be instantiated. The following must compile quietly: gcc -c gpr2-project-view.adb ---- package GNATCOLL is end GNATCOLL; package GNATCOLL.Refcount is generic type Element_Type (<>) is private; package Shared_Pointers is type Ref is tagged private; type Element_Access is access all Element_Type; type Reference_Type (Element : access Element_Type) is limited null record; function Unchecked_Get (Self : Ref'Class) return Element_Access; function Get (Self : Ref'Class) return Reference_Type is ((Element => Unchecked_Get (Self))); private type Ref is tagged null record; end Shared_Pointers; type Refcounted is abstract tagged null record; generic type Encapsulated is abstract new Refcounted with private; package Smart_Pointers is type Encapsulated_Access is access all Encapsulated'Class; type Ref is tagged private; procedure Set (Self : in out Ref; Data : Encapsulated'Class); procedure Set (Self : in out Ref; Data : access Encapsulated'Class); private type Ref is tagged null record; end Smart_Pointers; end GNATCOLL.Refcount; ---- package body GNATCOLL.Refcount is package body Shared_Pointers is function Unchecked_Get (Self : Ref'Class) return Element_Access is begin return null; end Unchecked_Get; end Shared_Pointers; package body Smart_Pointers is procedure Set (Self : in out Ref; Data : access Encapsulated'Class) is begin null; end Set; procedure Set (Self : in out Ref; Data : Encapsulated'Class) is Tmp : constant Encapsulated_Access := new Encapsulated'Class'(Data); begin Set (Self, Tmp); end Set; end Smart_Pointers; end GNATCOLL.Refcount; ---- package GPR2 is end GPR2; ---- package GPR2.Parser is end GPR2.Parser; ---- with GPR_Parser.Analysis; package GPR2.Parser.Project is end GPR2.Parser.Project; ---- package GPR2.Project is end GPR2.Project; ---- with GPR2.Parser.Project; package GPR2.Project.Configuration is end GPR2.Project.Configuration; ---- with GPR2.Project.Configuration; with GPR2.Unit.Set; package GPR2.Project.Definition is end GPR2.Project.Definition; ---- limited with GPR2.Unit.Set; package GPR2.Project.View is procedure Require_Body; end GPR2.Project.View; ---- with GPR2.Project.Definition; package body GPR2.Project.View is procedure Require_Body is null; end GPR2.Project.View; ---- package GPR2.Unit is end GPR2.Unit; package GPR2.Unit.Set is end GPR2.Unit.Set; ... package GPR_Parser is end GPR_Parser; ---- with GNATCOLL.Refcount; package GPR_Parser.Analysis is type Unit_Provider_Interface is null record; package Unit_Provider_References is new GNATCOLL.Refcount.Shared_Pointers (Unit_Provider_Interface); end GPR_Parser.Analysis; 2019-07-04 Ed Schonberg <schonberg@adacore.com> gcc/ada/ * sem_ch10.adb (Remove_Context_Clauses): Handle properly the removal of a limited_with_clause which appears in the library unit oF the main unit, when some other unit in the context has a regular with_clause on the same unit, to prevent spurious visibility errors in the subsequent analysis of pending instance bodies. From-SVN: r273067
Diffstat (limited to 'gcc/tree-object-size.c')
0 files changed, 0 insertions, 0 deletions