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=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,dfde03e75a411072,start X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.68.223.40 with SMTP id qr8mr19253425pbc.0.1340780297806; Tue, 26 Jun 2012 23:58:17 -0700 (PDT) Path: l9ni24835pbj.0!nntp.google.com!news1.google.com!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail From: kylix Newsgroups: comp.lang.ada Subject: GNAT GPL 2012 bug of iterator? Date: Tue, 26 Jun 2012 23:43:19 -0700 (PDT) Organization: http://groups.google.com Message-ID: NNTP-Posting-Host: 183.39.143.12 Mime-Version: 1.0 X-Trace: posting.google.com 1340780297 23768 127.0.0.1 (27 Jun 2012 06:58:17 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Wed, 27 Jun 2012 06:58:17 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=183.39.143.12; posting-account=4uMkDwoAAACMyNluw6CdeU7BMSgYHFMk User-Agent: G2/1.0 Content-Type: text/plain; charset=ISO-8859-1 Date: 2012-06-26T23:43:19-07:00 List-Id: 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;