comp.lang.ada
 help / color / mirror / Atom feed
From: Ludovic Brenta <ludovic@ludovic-brenta.org>
Subject: Representation item appears too late
Date: Thu, 25 Oct 2007 15:35:26 +0200
Date: 2007-10-25T15:35:26+02:00	[thread overview]
Message-ID: <87640vgvvl.fsf@ludovic-brenta.org> (raw)

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.

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?

Thanks for any advice.

-- 
Ludovic Brenta.



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

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-25 13:35 Ludovic Brenta [this message]
2007-10-25 13:46 ` Representation item appears too late Lucretia
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