comp.lang.ada
 help / color / mirror / Atom feed
From: Adam Beneschan <adam@irvine.com>
Subject: Re: Odd subtyping error.
Date: Fri, 5 Oct 2012 15:11:05 -0700 (PDT)
Date: 2012-10-05T15:11:05-07:00	[thread overview]
Message-ID: <da9d858a-19d2-4135-ae61-cb709418dc6c@googlegroups.com> (raw)
In-Reply-To: <5e6b8e61-50c5-4398-9407-60276a070f4f@googlegroups.com>

On Friday, October 5, 2012 2:00:53 PM UTC-7, Shark8 wrote:
> Package Subtype_Error is
> 
> 	Type Base_Type is (
> 		   Item_1, Item_2, Item_3, Item_4, Item_5
> 		   ) with Size => Integer'Size;
> 
> 	SubType Derived_Type is Base_Type Range Item_2..Item_4;
>     Private
> 	For Base_Type Use
> 	  (
> 		Item_1	=> 18,
> 		Item_2	=> 21,
> 		Item_3	=> 22,
> 		Item_4	=> 25,
> 		Item_5	=> 28
>    	  );
>     End Subtype_Error;

Ah, "the rest of the story"!  The size clause isn't the problem.  The problem is that referring to Item_2 and Item_4 in the declaration of Derived_Type freezes Base_Type, and you can't add any more representation information after that.  That makes "For Base_Type Use ..." illegal.  If the error messages in your original case pointed you to the wrong line numbers, that's something you can complain to the GNAT folks about.  But the error is legitimate, at least in your reduced source.

                              -- Adam




  reply	other threads:[~2012-10-05 22:11 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
2012-10-05 21:08   ` Shark8
2012-10-05 21:00 ` Shark8
2012-10-05 22:11   ` Adam Beneschan [this message]
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