From: Vincent Marciante <vincent.marciante@l3harris.com>
Subject: GNAT: no visible subprogram matches the specification for "Put"
Date: Fri, 4 Oct 2019 11:53:32 -0700 (PDT)
Date: 2019-10-04T11:53:32-07:00 [thread overview]
Message-ID: <1c12f540-00b8-4be8-bfc6-13ad31d9916c@googlegroups.com> (raw)
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;
next reply other threads:[~2019-10-04 18:53 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-04 18:53 Vincent Marciante [this message]
2019-10-05 10:50 ` GNAT: no visible subprogram matches the specification for "Put" Stephen Leake
2019-10-06 11:45 ` marciant
2019-10-07 11:55 ` vincent.marciante
2019-10-07 15:03 ` Stephen Leake
2019-10-07 19:00 ` Vincent Marciante
2019-10-07 19:01 ` briot.emmanuel
2019-10-08 10:01 ` Vincent Marciante
2019-10-08 14:53 ` Optikos
2019-10-08 17:48 ` Björn Lundin
2019-10-08 18:47 ` Vincent Marciante
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox