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-Thread: 103376,dd41b5654bd378e7 X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!postnews.google.com!22g2000hsm.googlegroups.com!not-for-mail From: Lucretia Newsgroups: comp.lang.ada Subject: Re: Representation item appears too late Date: Thu, 25 Oct 2007 06:46:28 -0700 Organization: http://groups.google.com Message-ID: <1193319988.230658.157760@22g2000hsm.googlegroups.com> References: <87640vgvvl.fsf@ludovic-brenta.org> NNTP-Posting-Host: 90.194.162.195 Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" X-Trace: posting.google.com 1193319988 7810 127.0.0.1 (25 Oct 2007 13:46:28 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Thu, 25 Oct 2007 13:46:28 +0000 (UTC) In-Reply-To: <87640vgvvl.fsf@ludovic-brenta.org> User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.8.1.8) Gecko/20061201 Firefox/2.0.0.8 (Ubuntu-feisty),gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: 22g2000hsm.googlegroups.com; posting-host=90.194.162.195; posting-account=ps2QrAMAAAA6_jCuRt2JEIpn5Otqf_w0 Xref: g2news2.google.com comp.lang.ada:2564 Date: 2007-10-25T06:46:28-07:00 List-Id: On Oct 25, 2:35 pm, Ludovic Brenta wrote: > Consider the following declarations: > > package A is > > type Size is (Small, Large); > > type Foo is range 1 .. 8; > > type T is record > A : Boolean; > B : Boolean; > C : Boolean; > D : Size_Type; Should be "Size" > E : Foo; > end record; > > procedure P (X : in T); -- a null procedure for the sake of example > > end A; > > with A; > package B is > > type T is new A.T; I didn't even know that this was possible! > for T use record -- line 5 > A at 0 range 0 .. 0; > B at 0 range 1 .. 1; > C at 0 range 2 .. 2; > D at 0 range 3 .. 3; > E at 0 range 4 .. 7; > end record; > > end B; > > Compiling B with GCC 4.1 I get: > > gcc-4.1 -c -g -O2 -gnatafnoy -gnatVa -gnatwa -I- -gnatA /home/lbrenta/src/ada/b.ads > b.ads:5:04: representation item appears too late > b.ads:5:04: primitive operations already defined for "T" > gnatmake: "/home/lbrenta/src/ada/b.ads" compilation error > > This also happens with GCC 4.2. > > Of course, removing procedure A.P also removes the error but this is > not an option. > > What should I do to specify a representation clause? Do I have to > resort to declaring a mirror type in B? Why? I've always put the representation clauses with the types they refer to. Luke.