I raised this in the ada-lang gitter channel and it was suggested that this is likely a bug, but figured I'd post here before raising a bug report just in case.
The following example program gives me a compile error with x86-64 gnat 12.2 (can also be seen at
https://ada.godbolt.org/z/45G1x9sEd)
example.adb:70:05: error: instantiation error at line 67
example.adb:70:05: error: "P_Formal_Type" is not a visible entity of "P_Instance"
-----
procedure Example is
generic
type E_Formal_Type is
abstract tagged private;
package E is end;
type E_Actual_Type is tagged null record;
package E_Instance is new E (E_Actual_Type);
generic
with package E_Formal_Pkg is new E (<>);
type D_Formal_Type is
new E_Formal_Pkg.E_Formal_Type with private;
package D is end;
type D_Actual_Type is
new E_Actual_Type with null record;
package D_Instance is
new D (E_Instance, D_Actual_Type);
generic
with package E_Formal_Pkg is new E (<>);
with package D_Formal_Pkg is
new D
(E_Formal_Pkg => E_Formal_Pkg,
others => <>);
type P_Formal_Type is
new E_Formal_Pkg.E_Formal_Type with private;
package P is end;
type P_Actual_Type is
new E_Actual_Type with null record;
package P_Instance is
new P (E_Instance, D_Instance, P_Actual_Type);
generic
with package E_Formal_Pkg is new E (<>);
with package D_Formal_Pkg is
new D (E_Formal_Pkg => E_Formal_Pkg,
others => <>);
with package P_Formal_Pkg is
new P
(E_Formal_Pkg => E_Formal_Pkg,
D_Formal_Pkg => D_Formal_Pkg,
others => <>);
package Test is
type Test_Type is
new P_Formal_Pkg.P_Formal_Type with null record; -- Line 67
end Test;
package Test_Instance is -- Line 70
new Test (E_Instance, D_Instance, P_Instance);
begin
null;
end Example;
---
Per ARM 12.7.10/2 I believe that should be legal?
A slight modification as can be seen at
https://ada.godbolt.org/z/4x4h4s7f5 compiles successfully.
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)