https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64869

Frédéric Bousquet <bousquetfrederic at outlook dot fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bousquetfrederic at outlook 
dot fr

--- Comment #3 from Frédéric Bousquet <bousquetfrederic at outlook dot fr> ---
I have the same problem with types defined in generic packages, and I think
it's the same bug.

I use GNAT 14.2.1 20250110 (Red Hat 14.2.1-7).


I run into errors when I compile the below program:

-----------------------------------------
with Ada.Text_IO; use Ada.Text_IO;

procedure Test_Use_Type is

   package Not_Generic is
      type TA is private;
      function F_TA return TA;
      procedure P_TA (A : TA);
   private
      type TA is new Integer;
   end Not_Generic;
   package body Not_Generic is
      function F_TA return TA is
      begin
         return 1;
      end F_TA;
      procedure P_TA (A : TA) is
      begin
         Put_Line (A'Image);
      end P_TA;
   end Not_Generic;

   generic
      TG : Integer;
   package Generic_Package is
      type TB is private;
      function F_TB return TB;
      procedure P_TB (B : TB);
   private
      type TB is new Integer range 1 .. TG;
   end Generic_Package;
   package body Generic_Package is
      function F_TB return TB is
      begin
         return 1;
      end F_TB;
      procedure P_TB (B : TB) is
      begin
         Put_Line (B'Image);
      end P_TB;
   end Generic_Package;

   use all type Not_Generic.TA;
   package Generic_1 is new Generic_Package (10);
   use all type Generic_1.TB;
   package Generic_2 is new Generic_Package (10);
   use all type Generic_2.TB;

   My_A  : Not_Generic.TA;
   My_B1 : Generic_1.TB := F_TB;  --  (1)
   My_B2 : Generic_2.TB;

begin
   My_A := F_TA;  --  (2)
   P_TA (My_A);   --  (3)
   P_TB (My_B1);  --  (4)
   My_B2 := F_TB; --  (5)
   P_TB (My_B2);  --  (6)
end Test_Use_Type;
-----------------------------------------

The output is :


gcc -c test_use_type.adb
test_use_type.adb:56:04: error: "P_TB" is not visible (more references follow)
test_use_type.adb:56:04: error: non-visible declaration from "Generic_2" at
line 28, instance at line 46
test_use_type.adb:56:04: error: non-visible declaration from "Generic_1" at
line 28, instance at line 44
test_use_type.adb:57:13: error: "F_TB" is not visible
test_use_type.adb:57:13: error: non-visible declaration from "Generic_2" at
line 27, instance at line 46
test_use_type.adb:57:13: error: non-visible declaration from "Generic_1" at
line 27, instance at line 44


For some reason (1) works, but not (5) and all others.

Reply via email to