comp.lang.ada
 help / color / mirror / Atom feed
* Generic oddness
@ 2020-04-12 12:32 Per Jakobsen
  2020-04-12 16:38 ` Ludovic Brenta
  2020-04-12 18:11 ` Simon Wright
  0 siblings, 2 replies; 4+ messages in thread
From: Per Jakobsen @ 2020-04-12 12:32 UTC (permalink / raw)


Declaring the package List_Type from Doubly_Linked_Lists gives me "abstract subprogram not allowed as generic actual" unless I declare the "A_Intf" type in a package separate from the List_Type declaration, or if I instantiate a workaround (dummy) generic before (as in the below MWE):

--- gnatchop ---------------------
generic
   type A is private;
package Gen is
   pragma Pure;
end Gen;
package Intf is
   type Intf_Type is interface;
   procedure Do_Stuff (I : in out Intf_Type) is abstract;
end Intf;
with Ada.Containers.Doubly_Linked_Lists;
with Intf;
with Gen;

package Test is
   use Intf;

   type A_Intf is new Intf_Type with
      record
         A : Natural;
      end record;

   overriding
   procedure Do_Stuff (I : in out A_Intf);

   package Workaround is new Gen (A => A_Intf);
   --  Commenting the above line will cause the
   --  next line to fail !?!?
   package List_Type is
      new Ada.Containers.Doubly_Linked_Lists (Element_Type => A_Intf,
                                              "="          => "=");
end Test;
package body Test is

   overriding
   procedure Do_Stuff (I : in out A_Intf) is
   begin
      null;
   end Do_Stuff;

end Test;
--- gnatchop end ---------------------

Unpack with gnatchop, then compile with gnatmake test.adb. Then comment the Workaround package instantiation and recompile.

Using GNATMAKE Community 2019 (20190517-83).

Is there a sane explanation for this behavior?

~Per

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-04-14  9:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-12 12:32 Generic oddness Per Jakobsen
2020-04-12 16:38 ` Ludovic Brenta
2020-04-14  9:42   ` SOLVED: " Per Jakobsen
2020-04-12 18:11 ` Simon Wright

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox