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.9 required=5.0 tests=BAYES_00,WEIRD_PORT autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,bf5045b7cee3d4b,start X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!news2.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx01.iad01.newshosting.com!newshosting.com!newsfeed.icl.net!newsfeed.fjserv.net!colt.net!feeder.news-service.com!feed.xsnews.nl!border-2.ams.xsnews.nl!212.27.60.7.MISMATCH!feeder1-1.proxad.net!proxad.net!feeder1-2.proxad.net!news.cs.univ-paris8.fr!u-psud.fr!not-for-mail From: Philippe Tarroux Newsgroups: comp.lang.ada Subject: tagged type as generic parameter Date: Thu, 03 Jan 2008 16:20:48 +0100 Organization: University Paris-Sud, France. Message-ID: NNTP-Posting-Host: osiris.limsi.fr Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Trace: news2.u-psud.fr 1199373552 1183 129.175.157.197 (3 Jan 2008 15:19:12 GMT) X-Complaints-To: newsmaster@u-psud.fr NNTP-Posting-Date: Thu, 3 Jan 2008 15:19:12 +0000 (UTC) User-Agent: Thunderbird 2.0.0.9 (Windows/20071031) Xref: g2news1.google.com comp.lang.ada:19174 Date: 2008-01-03T16:20:48+01:00 List-Id: Hi everybody, I wrote the following packages: generic type Data is tagged private; -- In order to be able to build lists of items of this type package List is type List (<>) is private; private type Item; type Item_Ptr is access Item; type Item is new Data with record -- Line 22 Next : Item_Ptr; end record; type List_Head is tagged record Head : Item_Ptr := null; end record; type List is access List_Head; end List; ----------------------------------- package data_handler is type Data is tagged private; function A_Data(V : Integer) return Data; procedure Print (D : Data); private type Data is tagged record Value : Integer; end record; end data_handler; ------------------------------------------- with List; with Data_Handler; use Data_Handler; package data_list is package My_List is new List (Data_Handler.Donn�es); end data_list; When i try to instantiate the last package (data_list) i get the following error: data_list.ads:7:04: instantiation error at list.ads:22 data_list.ads:7:04: type must be declared abstract or "a_data" overridden data_list.ads:7:04: "a_data" has been inherited at list.ads:22, instance at line 7 data_list.ads:7:04: "a_data" has been inherited from subprogram at data_handler.ads:5 I suspect the problem is due to the derivation of Item from Data at line 22 of list.ads during the instantiation of the generic but I don't really understand why and i don't understand why the problem arises with the function A_Data and not with the procedure Print. OS : W2K GCC version 4.1.3 20070403 for GNAT GPL 2007 Thank and best regards Philippe Tarroux