comp.lang.ada
 help / color / mirror / Atom feed
* Representation item appears too late
@ 2007-10-25 13:35 Ludovic Brenta
  2007-10-25 13:46 ` Lucretia
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Ludovic Brenta @ 2007-10-25 13:35 UTC (permalink / 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.



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2007-10-26  8:34 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2007-10-26  8:34   ` Ludovic Brenta

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