From: Per Jakobsen <pdj@knaldgas.dk>
Subject: Generic oddness
Date: Sun, 12 Apr 2020 05:32:41 -0700 (PDT)
Date: 2020-04-12T05:32:41-07:00 [thread overview]
Message-ID: <d2fedfee-ff14-40c4-bdfc-87c70d66281e@googlegroups.com> (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
next reply other threads:[~2020-04-12 12:32 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-12 12:32 Per Jakobsen [this message]
2020-04-12 16:38 ` Generic oddness Ludovic Brenta
2020-04-14 9:42 ` SOLVED: " Per Jakobsen
2020-04-12 18:11 ` Simon Wright
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox