This patch prevents spurious visibility errors due to use_clauses being ignored
when analyzing entities within a generic instance's template.
------------
-- Source --
------------
-- gnatcoll-json-support-test-test_vectors-integer_vectors-json.ads
with GNATCOLL.JSON.Support.Ada.Containers.Vectors;
with GNATCOLL.JSON.Support.Test.Test_Vectors.Integer_Vectors;
package GNATCOLL.JSON.Support.Test.Test_Vectors.Integer_Vectors.JSON is new
GNATCOLL.JSON.Support.Ada.Containers.Vectors
(V => GNATCOLL.JSON.Support.Test.Test_Vectors.Integer_Vectors,
Create => GNATCOLL.JSON.Create,
Get => GNATCOLL.JSON.Get);
-- gnatcoll-json-support-ada-containers-vectors.ads
with Ada.Containers.Vectors;
generic
with package V is new Standard.Ada.Containers.Vectors (<>);
use V; -- Ignored in instance leaving Element_Type invisible
with function Create (Val : Element_Type) return JSON_Value is <>;
with function Get (Val : JSON_Value) return Element_Type is <>;
package GNATCOLL.JSON.Support.Ada.Containers.Vectors is
end;
-- ... Additional files required
----------------------------
-- Compilation and output --
----------------------------
& gnatmake -q gnatcoll-json-support-test-test_vectors-integer_vectors-json.ads
cannot generate code for file gnatcoll-atomic.ads (package spec)
gnatmake: "gnatcoll-atomic.ads" compilation error
Tested on x86_64-pc-linux-gnu, committed on trunk
2017-11-09 Justin Squirek <[email protected]>
* sem_ch8.adb (Analyze_Use_Package): Force installation of use_clauses
when processing generic instances.
Index: sem_ch8.adb
===================================================================
--- sem_ch8.adb (revision 254563)
+++ sem_ch8.adb (working copy)
@@ -3821,8 +3821,11 @@
Check_In_Previous_With_Clause (N, Name (N));
end if;
- Use_One_Package (N, Name (N));
+ -- Force the use_clause when we are in a generic instance because the
+ -- scope of the package has changed and we must ensure visibility.
+ Use_One_Package (N, Name (N), Force => In_Instance);
+
-- Capture the first Ghost package and the first living package
if Is_Entity_Name (Name (N)) then