comp.lang.ada
 help / color / mirror / Atom feed
From: mheaney@ni.net (Matthew Heaney)
Subject: Is assignment available for access parameters?
Date: 1997/03/26
Date: 1997-03-26T00:00:00+00:00	[thread overview]
Message-ID: <mheaney-ya023680002603970130250001@news.ni.net> (raw)



Is assignment of an access parameter to an object of a named (general)
access type legal?  The code below compiles under my compiler (GNAT), but
not on others (Rational, Aonix).  Who is correct?

My expectation is that the assignment be illegal, because the type is
anonymous.  This would be analogous to the rule that types that have an
access discriminant must be limited.  (Of course, with a type conversion,
then the assignment can be made legal.)

But I'm not sure.  RM95 5.2 (4) states that the "expected type for the
expression [on the RHS] is the type of the target."  Is an access parameter
implicitly converted to the target type?

-- STX
package P is

   type T is tagged null record;

   type TA is access all T'Class;

end;


with P;
procedure Test_P is

   procedure Proc (OA : access P.T) is
      OTA : P.TA := OA;  -- ???
   begin
      null;
   end;

begin

   null;

end;
-- ETX

Matt

--------------------------------------------------------------------
Matthew Heaney
Software Development Consultant
<mailto:matthew_heaney@acm.org>
(818) 985-1271




             reply	other threads:[~1997-03-26  0:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-03-26  0:00 Matthew Heaney [this message]
1997-03-26  0:00 ` Is assignment available for access parameters? Samuel Tardieu
replies disabled

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