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-Thread: 103376,6cbbf1799c1dc6da X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!news2.google.com!proxad.net!134.158.69.22.MISMATCH!in2p3.fr!oleane.net!oleane!hunter.axlog.fr!nobody From: Jean-Pierre Rosen Newsgroups: comp.lang.ada Subject: Re: Ada 2005 box (<>) rules in default values Date: Wed, 18 Jan 2006 15:09:27 +0100 Organization: Adalog Message-ID: References: <43CCAB76.6050907@mailinator.com> <43CE20CF.4080801@mailinator.com> NNTP-Posting-Host: mailhost.axlog.fr Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Trace: s1.news.oleane.net 1137596497 671 195.25.228.57 (18 Jan 2006 15:01:37 GMT) X-Complaints-To: abuse@oleane.net NNTP-Posting-Date: Wed, 18 Jan 2006 15:01:37 +0000 (UTC) User-Agent: Mozilla Thunderbird 1.0.6 (Windows/20050716) X-Accept-Language: fr, en In-Reply-To: <43CE20CF.4080801@mailinator.com> Xref: g2news1.google.com comp.lang.ada:2520 Date: 2006-01-18T15:09:27+01:00 List-Id: Alex R. Mosteo a �crit : > Bj�rn Persson wrote: > >> This appears to be corrected in GCC 4.0.2 on Gnu/Linux, as it passes >> the test below. Alex, could you please compile this program and verify >> that it triggers the bug in your environment? If not, you might want >> to post a compilable test case that does display the error. > > > I'm sorry the example I wrote was made up on the way. Upon reflexion, I > think I always saw this problem in relation with Controlled types. > Here's an example which fails with my current GPL: > > with Ada.Text_IO; use Ada.Text_IO; > with Ada.Finalization; use Ada.Finalization; > > procedure Bug2005 is > > type Thing is new Controlled with record > First_Component : Integer; > Second_Component : Integer; > Third_Component : Integer; > end record; > > procedure Initialize (This : in out Thing) is > begin > This.Third_Component := 5; > end Initialize; > > type Superthing is record > Innerthing : Thing; > end record; > > Blah : Superthing := (others => <>); > Bleh : Superthing; > Blih : constant Superthing := (others => <>); > Bloh : constant Superthing := (Innerthing => <>); > Bluh : constant Superthing := (Innerthing => > (Controlled with others => <>)); > > begin > Put_Line(": Blah.Innerthing.Third_Component = " & > Integer'Image(Blah.Innerthing.Third_Component)); > Put_Line(": Bleh.Innerthing.Third_Component = " & > Integer'Image(Bleh.Innerthing.Third_Component)); > Put_Line(": Blih.Innerthing.Third_Component = " & > Integer'Image(Blih.Innerthing.Third_Component)); > Put_Line(": Bloh.Innerthing.Third_Component = " & > Integer'Image(Bloh.Innerthing.Third_Component)); > Put_Line(": Bluh.Innerthing.Third_Component = " & > Integer'Image(Bluh.Innerthing.Third_Component)); > end Bug2005; > That's totally different. Third_Component is not default-initialized, it is initialized by the Initialize procedure. And Initialize is /not/ called on aggregates. -- --------------------------------------------------------- J-P. Rosen (rosen@adalog.fr) Visit Adalog's web site at http://www.adalog.fr