From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,f45af6dd43d3673a X-Google-Attributes: gid103376,public From: Matthew Heaney Subject: Re: Controlled type question Date: 1999/02/15 Message-ID: #1/1 X-Deja-AN: 444474546 Sender: matt@mheaney.ni.net References: <36c743da.0@silver.truman.edu> NNTP-Posting-Date: Sun, 14 Feb 1999 20:58:20 PDT Newsgroups: comp.lang.ada Date: 1999-02-15T00:00:00+00:00 List-Id: v025@truman.edu (Chad R. Meiners) writes: > I am constructing a generic hash table ADT with the gnat 3.11p > compiler on win NT 4.0 SP3 and I have run into a compilier error when > I try to use the generic package. [snip] > I get the following errors > instantiation error at protected_hash_tables.ads :99 > instantiation error at protected_hash_tables.ads :20 > Controlled type must be declared at the library level > > The lines in protected_hash_tables are > > 99 : Type cObject is new Limited_Controlled with record ... > 20 : Type cObject is new Limited_Controller with private;--hash table object > > > the package compilied correctly so I think I might of run up against a > rule in the ARM. If anyone could explain what I did wrong please do > so. I will post more code if you need it. Yes, you hit upon a rule, the one that says Controlled type must be declared at the library level You have this: package GP is ... private type T is new ...; end GP; That's fine, but the illegal thing is doing this: package Q is ... package P is new GP (...); end Q; The problem is that inside the scope of package Q, you're not at library level, and so the instantiation of GP is illegal. You can try fixing it like this: package Q is ... end Q; private package Q.P is new GP (...); (I think that's it. Let me know if I interpreted things incorrectly.)