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 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,faeb0c2550699cee,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-12-15 23:11:00 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!opentransit.net!fu-berlin.de!news.uar.net!carrier.kiev.ua!news.kiev.sovam.com!Svitonline.COM!not-for-mail From: Maxim Reznik Newsgroups: comp.lang.ada Subject: controlled initialization Date: Mon, 16 Dec 2002 09:04:53 +0200 Organization: Svit Online (post does not reflect views of Golden Telecom) Message-ID: <3DFD7B15.9050800@mbank.com.ua> NNTP-Posting-Host: 212.109.37.91 Mime-Version: 1.0 Content-Type: text/plain; charset=KOI8-R; format=flowed Content-Transfer-Encoding: 7bit X-Trace: news.kiev.sovam.com 1040022657 30202 212.109.37.91 (16 Dec 2002 07:10:57 GMT) X-Complaints-To: abuse@svitonline.com NNTP-Posting-Date: 16 Dec 2002 07:10:57 GMT User-Agent: Mozilla/5.0 (X11; U; Linux i686; ru-RU; rv:1.0.0) Gecko/20020917 X-Accept-Language: ru, en Xref: archiver1.google.com comp.lang.ada:31874 Date: 2002-12-16T07:10:57+00:00 List-Id: Hi! Can you help me? I'm stuck with following example. I expected statement return Statement'(Ada.Finalization.Controlled with C => 0); created object of type Statement, then Initialyze procedure would be called for it and Put_Line printed "Init". But when I compile program with GNAT 3.15p for Linux it doesn't happen. May be it's bug of GNAT? Thank you Maxim Reznik ------------------------------------ with Ada.Finalization; package Tests is type Statement is new Ada.Finalization.Controlled with record C : Integer; end record; procedure Initialize (Item : in out Statement); subtype Class is Ada.Finalization.Controlled'Class; function Create_Statement return Class; end Tests; ------------------------------------ with Ada.Text_IO; package body Tests is procedure Initialize (Item : in out Statement) is begin Ada.Text_IO.Put_Line ("Init"); end Initialize; function Create_Statement return Class is begin return Statement'(Ada.Finalization.Controlled with C => 0); end Create_Statement; end Tests; ------------------------------------ with Tests; procedure Test is use Tests; Object : Class := Create_Statement; begin null; end Test;