comp.lang.ada
 help / color / mirror / Atom feed
* Definition of "aliased"
@ 1998-10-26  0:00 Matthew Heaney
  1998-10-26  0:00 ` dennison
  1998-10-26  0:00 ` Tucker Taft
  0 siblings, 2 replies; 6+ messages in thread
From: Matthew Heaney @ 1998-10-26  0:00 UTC (permalink / raw)


What is the definition of "aliased"?  I thought
--per RM95 3.10 (9)-- that the "current instance" of a limited type was
defined to be aliased.

Yet when I try to compile this code fragment...

package P is
   type T is tagged limited private;
private
   function Op (O : access T) return Integer;
   type T is
      tagged limited record
         I : Integer := Op (T'Access);
      end record;
end P;


with P;
procedure Test_P is
   O : P.T;
begin
   null;
end;

...my compiler is telling me that

(start of message)
$ gnatmake test_p
gcc -c test_p.adb
p.ads:7:29: prefix of "Access" attribute must be aliased
gnatmake: "test_p.adb" compilation error
(end of message)

The behavior of function Op appears to be no different from Initialize
for a Controlled type.  What's the difference?

I was trying to do some non-trivial default initialization for objects
of the type, without deriving from Controlled and overriding
Initialize.  The latter approach seems like too heavy a solution.

Thanks,
Matt








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

end of thread, other threads:[~1998-10-28  0:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-10-26  0:00 Definition of "aliased" Matthew Heaney
1998-10-26  0:00 ` dennison
1998-10-26  0:00   ` Matthew Heaney
1998-10-27  0:00     ` dennison
1998-10-28  0:00       ` Robert I. Eachus
1998-10-26  0:00 ` Tucker Taft

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