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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,758ad7877a64226f,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-05-10 05:12:31 PST Date: Sat, 10 May 2003 14:02:09 +0200 From: alfonso acosta User-Agent: Mozilla/5.0 (X11; U; Linux i686; es-AR; rv:1.3) Gecko/20030430 Debian/1.3-5 X-Accept-Language: es, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: deallocating class wide types Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 213.9.251.91 Message-ID: <3ebcea42$1_4@news.arrakis.es> X-Trace: caladan.arrakis.es 1052568130 213.9.251.91 (10 May 2003 14:02:10 +0100) Organization: Arrakis Servicios y Comunicaciones SLU Path: archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-04!sn-xit-06!sn-xit-09!supernews.com!router1.news.adelphia.net!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!out.nntp.be!propagator2-sterling!in.nntp.be!caladan.arrakis.es Xref: archiver1.google.com comp.lang.ada:37142 Date: 2003-05-10T14:02:09+02:00 List-Id: hi: I provide a simplified example of my problem: package spec: ---------------------------------------------------------------- package My_Class is type My_Class is abstract tagged null record; type My_Class_Access is access all My_Class'Class; procedure Destroy (Object: in out My_Class_Access); end My_Class; ---------------------------------------------------------------- first body approach: ---------------------------------------------------------------- with Ada.Unchecked_Deallocation; package body My_Class is procedure Free is new Ada.Unchecked_Deallocation(Name => My_Class_Access, Object => My_Class'Class); procedure Destroy (Object: in out My_Class_Access) renames Free; end My_Class; ---------------------------------------------------------------- I get: my_class.adb:7:59: subprogram used in renaming_as_body cannot be intrinsic second approach: ---------------------------------------------------------------- with Ada.Unchecked_Deallocation; package body My_Class is procedure Free is new Ada.Unchecked_Deallocation(Name => My_Class_Access, Object => My_Class'Class); procedure Destroy (Object: in out My_Class_Access) is begin Free(My_Class_Access); end Destroy; end My_Class; ------------------------------------------------------------------ I get: my_class.adb:9:09: Invalid use of subtype mark in expression or call Can someone tell me what Im doing wrong? And, should Destroy work with any type which extends My_Class? Thanks in advance: Alfonso Acosta