comp.lang.ada
 help / color / mirror / Atom feed
From: bcf@ssd.ray.com (Felaco)
Subject: Renaming record discriminants.
Date: 1996/04/01
Date: 1996-04-01T00:00:00+00:00	[thread overview]
Message-ID: <Dp75Aq.B1o@ssd.ray.com> (raw)
In-Reply-To: 3152FC34.648B@nl.cis.philips.com

I just tried do something like the following:

   type Record_Type(Has_Value : Boolean) is
       record
         case Has_Value is
            when True =>
	        Value : Integer;
            when False =>
                null;
         end case;

   Object : Record_Type := (Has_Value => True, Value => 1);

   Discriminant : Boolean renames Object.Has_Value; -- error
   Component : Integer renames Object.Value; -- error

(there may be a typo or something in there, this is off the top of my head)

The Intermetrics compiler I am using complains that:
Object.Has_Value depends on discriminants of an unconstrained formal 
parameter with default discriminants [RM_95 8.5.1(5)]

RM_95 8.5.1(5) reads:
   The renamed entity shall not be a subcomponent that depends on
   discriminants of a variable whose nominal subtype is unconstrained,
   unless this subtype is indefinite, or the variable is aliased. A
   slice of an array shall not be renamed if this restriction
   disallows renaming of the array. 

This says to me that the second renames I have is illegal.  I am not sure 
why the first renames is illegal.  Why can't I rename the discriminant?

Note that in the real code, the Object is an 'in' parameter.

I'm not sure if this is a language issue, a compiler problem, or just a 
lack of understanding on my part.  Could anyone help clarify?

Thanks...

--
-------------------------------------------------------------------------------
Chris Felaco                               Phone: x4631 (Raynet 444, Local 842)
Raytheon Company                                         Email: bcf@ssd.ray.com
-------------------------------------------------------------------------------




  reply	other threads:[~1996-04-01  0:00 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-03-21  0:00 Win32Ada Pascal OBRY
1996-03-21  0:00 ` Win32Ada Robert F. Estes
1996-03-28  0:00   ` Win32Ada Carl J R Johansson
1996-03-28  0:00     ` Win32Ada Ted Dennison
     [not found]       ` <4jf4uhINNsad@RA.DEPT.CS.YALE.EDU>
1996-03-29  0:00         ` Win32Ada Ted Dennison
1996-03-29  0:00   ` Win32Ada lrharris
1996-03-22  0:00 ` Win32Ada Wiljan Derks
1996-04-01  0:00   ` Felaco [this message]
1996-04-01  0:00     ` Renaming record discriminants Tucker Taft
1996-04-01  0:00       ` David Weller
1996-04-02  0:00       ` Robert Dewar
replies disabled

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