-- RM 12.6(10):
-- If a generic unit has a subprogram_default specified by a box, and
-- the corresponding actual parameter is omitted, then it is
-- equivalent to an explicit actual parameter that is a usage name
-- identical to the defining name of the formal.

package pak1 is
   procedure p1;
end pak1;

package body pak1 is

   procedure p1 is
   begin
      null;
   end p1;

end pak1;

generic
   with procedure p1 is <>;
package pak1.pak2 is
end pak1.pak2;

with pak1.pak2;
package pak1.pak2a is new pak1.pak2;         -- OK, but Gnat rejects

with pak1.pak2;
package pak1.pak2b is new pak1.pak2(p1);     -- Gnat allows

gnatmake pak1-pak2a
gcc-4.1 -c pak1-pak2a.ads
pak1-pak2a.ads:3:01: "p1" is not visible
pak1-pak2a.ads:3:01: non-visible declaration at pak1-pak2.ads:3
pak1-pak2a.ads:3:01: non-visible declaration at pak1.ads:8

Same in 4.2.2.


-- 
           Summary: Legal program rejected, RM 12.6(10): generic formal
                    subprogram with implicit default
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ada
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: ludovic at ludovic-brenta dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34511

Reply via email to