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,dfde03e75a411072 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.68.228.227 with SMTP id sl3mr19363227pbc.5.1340783259862; Wed, 27 Jun 2012 00:47:39 -0700 (PDT) Path: l9ni24971pbj.0!nntp.google.com!news1.google.com!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail From: Martin Newsgroups: comp.lang.ada Subject: Re: GNAT GPL 2012 bug of iterator? Date: Wed, 27 Jun 2012 00:46:20 -0700 (PDT) Organization: http://groups.google.com Message-ID: <13ef2da8-c057-4727-9d1d-2bd516e37657@googlegroups.com> References: NNTP-Posting-Host: 20.133.0.8 Mime-Version: 1.0 X-Trace: posting.google.com 1340783259 22116 127.0.0.1 (27 Jun 2012 07:47:39 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Wed, 27 Jun 2012 07:47:39 +0000 (UTC) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=20.133.0.8; posting-account=g4n69woAAACHKbpceNrvOhHWViIbdQ9G User-Agent: G2/1.0 Content-Type: text/plain; charset=ISO-8859-1 Date: 2012-06-27T00:46:20-07:00 List-Id: On Wednesday, June 27, 2012 7:43:19 AM UTC+1, kylix wrote: > I try to compile the test code under GNAT GPL 2012, and it give a error message: > gcc -c -O2 test.adb > test.adb:42:13: invalid prefix in selected component "c" > gnatmake: "test.adb" compilation error > > It seems can't use list iterator in generic package. > > Here are the test code: > > pragma Ada_2012; > with Ada.Text_IO; > with Ada.Containers, Ada.Containers.Doubly_Linked_Lists; > use Ada.Containers; > procedure test is > > package Foo is > > type Rect_Type is tagged record > w, h, a : Integer := 0; > end record; > > procedure Calc (this : in out Rect_Type); > > type Rect_Ptr is access Rect_Type; > end Foo; > > package body Foo is > > procedure Calc (this : in out Rect_Type) is > begin > this.a := this.w * this.h; > end Calc; > > end Foo; > > > generic > package Generic_Pkg is > use Foo; > package Lists is new Doubly_Linked_Lists(Foo.Rect_Type); > > procedure Calc (list : in out Lists.List); > > end Generic_Pkg; > > package body Generic_Pkg is > > procedure Calc (list : in out Lists.List) is > begin > for c of list loop > c.Calc; -- if this code not in generic package, it works fine > end loop; > end; > end Generic_Pkg; > > package Rect is new Generic_Pkg; > > rs : Rect.Lists.List; > > begin > for i in 1 .. 5 loop > rs.Append ((others => i)); > end loop; > Rect.Calc(rs); > for c of rs loop > Ada.Text_IO.Put_Line (Integer'Image(c.a)); > end loop; > end test; Same message in GNAT Pro 7.1.0 [actually GNAT Pro 7.1.0w (20120523-45)] -- Martin