From: Jeremiah <jeremiah.breeden@gmail.com>
Subject: Incomplete types used with generics
Date: Mon, 11 May 2015 15:37:19 -0700 (PDT)
Date: 2015-05-11T15:37:19-07:00 [thread overview]
Message-ID: <830c0323-a06c-4884-9214-89f3ee6f17b5@googlegroups.com> (raw)
One of the things I read about with ada2012 is the ability to use incomplete types as generic parameters. However, I am having some trouble implementing them. I'm using GNAT GPL 2014 and have the following dumbed down packages:
generic
type Item_Type is tagged limited private;
type Item_Access is access Item_Type;
package Test_Generic is
type Test is tagged record
Ref : Item_Access := null;
end record;
end Test_Generic;
with Test_Generic;
package Test_Nodes is
type Node3_ptr is null record;
type Node1_Type is tagged record
value : Integer := 0;
end record;
type Node1_Access is access Node1_Type;
package N1 is new Test_Generic(Node1_Type,Node1_Access);
type Node2_Type is tagged;
type Node2_Access is access Node2_Type;
package N2 is new Test_Generic(Node2_Type,Node2_Access);
type Node2_Type is tagged record
value : Integer := 1;
Test : N2.Test;
end record;
end Test_Nodes;
However, the line
package N2 is new Test_Generic(Node2_Type,Node2_Access);
fails with: premature use of incomplete type
I *think* the generic parameter "type Item_Type is tagged limited private;" is considered incomplete as is "type Node2_Type is tagged;".
What am I missing?
Ada2012 incomplete types with generics reference:
http://www.ada-auth.org/standards/12rat/html/Rat12-4-3.html
next reply other threads:[~2015-05-11 22:37 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-11 22:37 Jeremiah [this message]
2015-05-12 1:43 ` Incomplete types used with generics Randy Brukardt
2015-05-12 7:33 ` Simon Wright
2015-05-12 11:48 ` Jeremiah
2015-05-12 11:46 ` Jeremiah
2015-05-12 21:49 ` Randy Brukardt
2015-05-12 23:19 ` Jeremiah
2015-05-14 1:14 ` Randy Brukardt
2015-05-14 20:48 ` Jeremiah
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox