comp.lang.ada
 help / color / mirror / Atom feed
From: Adam Beneschan <adam@irvine.com>
Subject: Re: Odd subtyping error.
Date: Fri, 5 Oct 2012 11:44:36 -0700 (PDT)
Date: 2012-10-05T11:44:36-07:00	[thread overview]
Message-ID: <2299402b-d975-4ea6-8794-2657f4b722ad@googlegroups.com> (raw)
In-Reply-To: <ad8m81FtdrcU1@mid.individual.net>

On Friday, October 5, 2012 11:12:18 AM UTC-7, Niklas Holsti wrote:
> On 12-10-05 19:05 , Shark8 wrote:
> 
> > I'm making a new OpenGL binding taking advantage of Ada 2012 and have come across several interesting errors, including a compiler-bug... but this one is by far the oddest:
> 
> >     Type Pixel_Storage is (
> > 	UNPACK_SWAP_BYTES,	UNPACK_LSB_FIRST,	UNPACK_ROW_LENGTH,		
> > 	UNPACK_SKIP_ROWS,	UNPACK_SKIP_PIXELS,	UNPACK_ALIGNMENT,
> > 	PACK_SWAP_BYTES,	PACK_LSB_FIRST,		PACK_ROW_LENGTH,
> > 	PACK_SKIP_ROWS,		PACK_SKIP_PIXELS,	PACK_ALIGNMENT,
> > 	PACK_SKIP_IMAGES,	PACK_IMAGE_HEIGHT,	UNPACK_SKIP_IMAGES,
> > 	UNPACK_IMAGE_HEIGHT
> > 			  ) with Size => Enum'Size;
> > 
> 
> >     SubType Pixel_Packing is Pixel_Storage Range PACK_SWAP_BYTES..PACK_IMAGE_HEIGHT;
> 
> > Unless I'm just completely misunderstanding the above should be perfectly fine, yet it generates a few errors:
> 
> > 	warning: no more representation items for type "Pixel_Storage" defined at line 625
> > 	representation item appears too late [private section representation-clause]
> 
> It would be easier to answer you if you showed a complete, minimal
> example (i.e. an .ads file) where you have removed the irrelevant parts.
> 
> The second error/warning line suggests to me that you have declared
> Pixel_Storage first as a "private" type, and that the full type
> declaration, including the "with Size" clause, appears only in the
> "private" part of the package declaration. Is that the case?

I agree that a more complete example would be helpful.  However, I can't imagine how the fact that it's declared as private could make a difference.  A private type's full declaration must occur before the type is frozen, so if something occurred earlier that would freeze the type, he would have gotten error messages at that point.  The error message he's getting seems to imply that the compiler already thinks the type is frozen by the time it sees the aspect clause, which is impossible; or, if it's displaying the error when it sees the subtype declaration, then it's just plain lost its head.

                            -- Adam




  reply	other threads:[~2012-10-05 18:44 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-05 16:05 Odd subtyping error Shark8
2012-10-05 18:12 ` Niklas Holsti
2012-10-05 18:44   ` Adam Beneschan [this message]
2012-10-05 21:08   ` Shark8
2012-10-05 21:00 ` Shark8
2012-10-05 22:11   ` Adam Beneschan
2012-10-05 22:19     ` Shark8
2012-10-06  3:08       ` Adam Beneschan
2012-10-06  4:40         ` Shark8
2012-10-06 21:21       ` sbelmont700
2012-10-06 22:08         ` Shark8
replies disabled

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