From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,WEIRD_QUOTING autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 2002:ac8:3267:: with SMTP id y36mr20930821qta.375.1570272634254; Sat, 05 Oct 2019 03:50:34 -0700 (PDT) X-Received: by 2002:a9d:7359:: with SMTP id l25mr13049479otk.329.1570272633847; Sat, 05 Oct 2019 03:50:33 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!feeder.eternal-september.org!news.gegeweb.eu!gegeweb.org!fdn.fr!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!o24no9209298qtl.0!news-out.google.com!q23ni15qtl.1!nntp.google.com!o24no9209295qtl.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Sat, 5 Oct 2019 03:50:33 -0700 (PDT) In-Reply-To: <1c12f540-00b8-4be8-bfc6-13ad31d9916c@googlegroups.com> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=76.77.182.20; posting-account=W2gdXQoAAADxIuhBWhPFjUps3wUp4RhQ NNTP-Posting-Host: 76.77.182.20 References: <1c12f540-00b8-4be8-bfc6-13ad31d9916c@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <96d5218a-2714-40dd-988d-10c7d27a96a2@googlegroups.com> Subject: Re: GNAT: no visible subprogram matches the specification for "Put" From: Stephen Leake Injection-Date: Sat, 05 Oct 2019 10:50:34 +0000 Content-Type: text/plain; charset="UTF-8" Xref: reader01.eternal-september.org comp.lang.ada:57252 Date: 2019-10-05T03:50:33-07:00 List-Id: On Friday, October 4, 2019 at 11:53:34 AM UTC-7, Vincent Marciante wrote: > Hi all, > > I think that I might be hitting a GNAT defect but am not sure. > I already have a work-around but wanted some feedback before > I go through channels to submit this to Adacore (if actually > a defect.) Maybe I am missing some overloading rule but I > think that the following should compile and run: one part that > appears in the middle does compile and does produce the expected > output but the second to last unit does not compile useing a > GNATPRO 19 series compiler. That place is marked with --Builder > results. > > So, should all of the following be compilable? > > with Ada.Text_IO; > > package Ada_Text_IO_Adaptor is > > procedure Put > (X : in Integer; > Base : in Ada.Text_IO.Number_Base); > > procedure New_Line; > > end Ada_Text_IO_Adaptor; > > ------- > > with Ada.Integer_Text_IO; > > package body Ada_Text_IO_Adaptor is > > procedure Put > (X : in Integer; > Base : in Ada.Text_IO.Number_Base) is > begin > Ada.Integer_Text_IO.Put(Item=>X,Base=>Base); > end Put; > > procedure New_Line is > begin > Ada.Text_IO.New_Line; > end New_Line; > > end Ada_Text_IO_Adaptor; > > ------- > > generic > > type Number_Base is range <>; > Default_Base : Number_Base; > > with procedure Put (X : in Integer; > Base : in Number_Base > := Default_Base) is <>; > with procedure Put (X : in String) is <>; > with procedure Put_Line (X : in String) is <>; > with procedure New_Line is <>; > > package Signature_Package_Generic is end; > > ------- > > with Ada.Text_IO, Ada.Integer_Text_IO, Ada_Text_IO_Adaptor; > use Ada.Text_IO, Ada.Integer_Text_IO, Ada_Text_IO_Adaptor; > > with Signature_Package_Generic; > > package Signature_Package_Instance is > new Signature_Package_Generic > (Number_Base => Ada.Text_IO.Number_Base, > Default_Base => 10); > > ------- > > with Signature_Package_Generic; > generic > with package Instance is new Signature_Package_Generic(<>); > procedure Signature_Package_Instance_Test_Generic; > > ------- > > procedure Signature_Package_Instance_Test_Generic is > begin > Instance.New_Line; > Instance.Put_Line("Direct Instance Put_Line(""string"")"); > Instance.Put ("Direct Instance Put (""string"")"); > end; > > ------- > > with Signature_Package_Instance; > with Signature_Package_Instance_Test_Generic; > procedure Signature_Package_Instance_Test is > new Signature_Package_Instance_Test_Generic > (Signature_Package_Instance); --compiles and runs as expected > > ------- > > with Signature_Package_Generic; > generic > with package Instance is new Signature_Package_Generic(<>); > package Signature_Package_Reexport_Generic is > > subtype Number_Base is Instance.Number_Base; > Default_Base : Number_Base := Instance.Default_Base; > > procedure Put (X : in Integer; > Base : in Number_Base > := Default_Base) renames Instance. Put; > procedure Put (X : in String) renames Instance. Put; -- instantiation error > procedure Put_Line (X : in String) renames Instance. Put_Line; > procedure New_Line renames Instance. New_Line; > > end Signature_Package_Reexport_Generic; > > ------- > > with Signature_Package_Instance; > with Signature_Package_Reexport_Generic; > package Signature_Package_Reexport_Instance is > new Signature_Package_Reexport_Generic > (Signature_Package_Instance); > --Builder results > -- Signature_Package_Reexport_Instance.ads > -- 108:1 instantiation error at signature_package_reexport_generic.ads:98 > -- 108:1 no visible subprogram matches the specification for "Put" > > ------- > > with Signature_Package_Reexport_Instance; > procedure Signature_Package_Reexport_Test is > begin > Signature_Package_Reexport_Instance.New_Line; > Signature_Package_Reexport_Instance.Put_Line("Reexport Put_Line(""string"")"); > Signature_Package_Reexport_Instance.Put ("Reexport Put (""string"")"); > end; What "Put" do you think is visible at the declaration of Signature_Package_Reexport_Instance? There is no "use" clause in effect. -- Stephe