From: ehsjony@ehs.ericsson.se (Jonas Nygren)
Subject: Problem with type derivation and packages
Date: 1996/02/18
Date: 1996-02-18T00:00:00+00:00 [thread overview]
Message-ID: <4g79ul$ikh@erinews.ericsson.se> (raw)
I am experiencing a problem which I don't understand
and followingly can't correct. I hope somebody in
c.l.a can help me.
I try to implement a container type which share data
structures. This works in a different version but when
I reorganized my code I got a strange error message
from Gnat (3.01, Sun Solaris). When compiling my
little test program, Test2, I got the following
messages from Gnat:
gcc -c -k8 test2.adb
test2.adb:3:04: expected private type "Reference" defined at sharobje.ads:26
test2.adb:3:04: found private type "Container" defined at containe.ads:17
Test2:
======
with Int_Conts; use Int_Conts.Int_Cont;
procedure Test2 is
C : Container;
begin
null;
end Test2;
I simply cannot understand why Gnat expects 'private type "Reference"'
when I have declared a Container? I want to declare a Container
and not a Reference! What am I doing wrong?
Any help is appreciated,
/jonas
Below follows the rest of the spec files - some shortened
to problem essentials. These files can be run through Gnat
without any error reports.
Int_Conts:
==========
with Containers;
package Int_Conts is
package Int_Cont is new Containers(Integer);
end Int_Conts;
Containers:
===========
with Shared_Objects;
generic
type Container_Item is private;
package Containers is
type Container is private;
-- some decls removed
private
type Store is array(Index range <>) of aliased Container_Item;
package Shared_Store is new Shared_Objects(Store);
use Shared_Store;
type Container is new Shared_Store.Reference;
-- some decls removed
end Containers;
Shared_Objects:
===============
with Ada.Finalization;
generic
type Object(<>) is private;
package Shared_Objects is
type Object_Access is access all Object;
type Reference is private;
-- some decls removed
private
type Shared_Object is record
Ref_Count : Natural;
Obj_Ref : Object_access;
end record;
type Shared_Object_Ref is access all Shared_Object;
type Reference is new Ada.Finalization.Controlled with record
Ref : Shared_Object_Ref := null;
end record;
-- some decls removed
end Shared_Objects;
reply other threads:[~1996-02-18 0:00 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox