comp.lang.ada
 help / color / mirror / Atom feed
From: Vincent Marciante <INALID_EXCEPT_FOR_marciant@earthlink.net>
Subject: Re: Representation item appears too late
Date: Fri, 26 Oct 2007 00:08:18 -0400
Date: 2007-10-26T00:08:18-04:00	[thread overview]
Message-ID: <47216832.54B2@earthlink.net> (raw)
In-Reply-To: 87640vgvvl.fsf@ludovic-brenta.org

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;
>       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;
>    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.

How about:


package A is

   type Size is (Small, Large);

   type Foo is range 1 .. 8;

   package Base is
      type T is record
         A : Boolean;
         B : Boolean;
         C : Boolean;
         D : Size;
         E : Foo;
      end record;
   end Base; 

   type T is new Base.T;

   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.Base.T;
   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;


Vinny


--




  parent reply	other threads:[~2007-10-26  4:08 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
2007-10-25 15:41 ` Adam Beneschan
2007-10-25 18:37   ` Ludovic Brenta
2007-10-26  4:08 ` Vincent Marciante [this message]
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