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

            Bug ID: 64869
           Summary: "use all type" clause is ineffective
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ada
          Assignee: unassigned at gcc dot gnu.org
          Reporter: demoonlit at panathenaia dot halfmoon.jp

"use all type" clauses for nested packages from an outer subprogram are
ineffective.

procedure case1 is
   package P is
      type T is (X, Y, Z);
      procedure Proc (Obj : T) is null;
   end P;
-- procedure Nested is
--    use all type P.T; -- effective in nested subprogram
--    Obj : P.T := X;
-- begin
--    Proc (Obj); -- visible
-- end Nested;
   use all type P.T;
   Obj : P.T := X; -- invisible
begin
   Proc (Obj); -- invisible
end case1;

% gcc -c case1.adb 
case1.adb:2:09: missing body for "P"
case1.adb:13:22: "X" is not visible
case1.adb:13:22: non-visible declaration at line 3
case1.adb:15:09: "Proc" is not visible
case1.adb:15:09: non-visible declaration at line 4

with Ada.Containers.Vectors;
procedure case2 is
   package Vectors is new Ada.Containers.Vectors (Positive, Character);
-- procedure Nested is
--    use all type Vectors.Vector; -- effective in nested subprogram
--    X : Vectors.Vector := To_Vector (0); -- visible
-- begin
--    Append (X, 'A'); -- visible
-- end Nested;
   use all type Vectors.Vector;
   X : Vectors.Vector := To_Vector (0); -- visible
begin
   Append (X, 'A'); -- invisible
end case2;

% gcc -c case2.adb
case2.adb:13:09: "Append" is not visible
case2.adb:13:09: non-visible declaration at a-convec.ads:243, instance at line
3
case2.adb:13:09: non-visible declaration at a-convec.ads:239, instance at line
3

Note, "use all type" clauses from nested sibling subprograms (commented out
subprograms "Nested" in above examples) are effective, and, strangely, above
examples will become to be compiled with the subprograms "Nested" (??)

Reply via email to