comp.lang.ada
 help / color / mirror / Atom feed
From: Lucretia <lucretia9@lycos.co.uk>
Subject: Re: Representation item appears too late
Date: Thu, 25 Oct 2007 06:46:28 -0700
Date: 2007-10-25T06:46:28-07:00	[thread overview]
Message-ID: <1193319988.230658.157760@22g2000hsm.googlegroups.com> (raw)
In-Reply-To: <87640vgvvl.fsf@ludovic-brenta.org>

On Oct 25, 2:35 pm, Ludovic Brenta <ludo...@ludovic-brenta.org> 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.





  reply	other threads:[~2007-10-25 13:46 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-25 13:35 Representation item appears too late Ludovic Brenta
2007-10-25 13:46 ` Lucretia [this message]
2007-10-25 15:41 ` Adam Beneschan
2007-10-25 18:37   ` Ludovic Brenta
2007-10-26  4:08 ` Vincent Marciante
2007-10-26  8:34   ` Ludovic Brenta
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox