That's an old issue, but the fix is quite straightforward.
gcc/ada/
PR ada/89159
* sem_ch6.adb (Conforming_Types.Is_Matching_Limited_View): Return
true when the type is an incomplete view of the non-limited view.
gcc/testsuite/
* gnat.dg/limited_with8.adb: New test.
* gnat.dg/limited_with8_pkg1.ads: New helper.
* gnat.dg/limited_with8_pkg2.ads: Likewise.
* gnat.dg/limited_with8_pkg2.adb: Likewise.
end if;
end Null_Exclusions_Match;
+ -----------------------------------------------
+ -- Subprogram_Subtypes_Have_Same_Declaration --
+ -----------------------------------------------
+
function Subprogram_Subtypes_Have_Same_Declaration
(Subp : Entity_Id;
Decl_Subtype : Entity_Id;
if Typ = View then
return True;
+ -- The type is an incomplete view of the non-limited view
+
+ elsif Is_Incomplete_Type (Typ) and then Full_View (Typ) = View then
+ return True;
+
-- The type is a subtype of the non-limited view
elsif Is_Subtype_Of (Typ, View) then
--- /dev/null
+-- { dg-do link }
+
+with Limited_With8_Pkg1;
+
+procedure Limited_With8 is
+begin
+ null;
+end;
--- /dev/null
+with Limited_With8_Pkg2;
+
+package Limited_With8_Pkg1 is
+ type T;
+ type T is new Integer;
+end Limited_With8_Pkg1;
--- /dev/null
+with Limited_With8_Pkg1;
+
+package body Limited_With8_Pkg2 is
+ procedure G (Container : in M;
+ F : access function return Limited_With8_Pkg1.T) is
+ Item : Limited_With8_Pkg1.T := F.all;
+ begin
+ null;
+ end G;
+end Limited_With8_Pkg2;
--- /dev/null
+limited with Limited_With8_Pkg1;
+
+package Limited_With8_Pkg2 is
+ type M is tagged null record;
+ procedure G (Container : in M;
+ F : access function return Limited_With8_Pkg1.T);
+end Limited_With8_Pkg2;