comp.lang.ada
 help / color / mirror / Atom feed
* Obtaining access to protected object
@ 2008-07-08 20:41 Maciej Sobczak
  2008-07-09 15:03 ` Adam Beneschan
  2008-07-09 15:33 ` george.priv
  0 siblings, 2 replies; 10+ messages in thread
From: Maciej Sobczak @ 2008-07-08 20:41 UTC (permalink / raw)


Consider 9.4-21/2:

"Within the declaration or body of a protected unit other than in an
access_definition, the name of the protected unit denotes the current
instance of the unit"

I understand that this allows me to obtain the access to the current
object (the "this" access) of the protected object.
Let's try:

   protected type P is
      procedure Foo;
   end P;

   protected body P is
      procedure Foo is
         Ptr : access P;   -- P denotes the type P
      begin
         Ptr := P'Access;    -- here P denotes the "this" instance of
P
      end;
   end P;

This is what GNAT has to say about it: ""Access" attribute cannot be
applied to type".
As far as I understand, this is in conflict with the AARM paragraph
mentioned above.

Am I doing something wrong or is it a compiler bug?

--
Maciej Sobczak * www.msobczak.com * www.inspirel.com



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

end of thread, other threads:[~2008-07-10 14:46 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-07-08 20:41 Obtaining access to protected object Maciej Sobczak
2008-07-09 15:03 ` Adam Beneschan
2008-07-09 21:21   ` Maciej Sobczak
2008-07-09 21:57     ` Adam Beneschan
2008-07-09 22:01     ` Georg Bauhaus
2008-07-10  0:39     ` Randy Brukardt
2008-07-09 15:33 ` george.priv
2008-07-09 19:27   ` Adam Beneschan
2008-07-10  2:10     ` george.priv
2008-07-10 14:46       ` Adam Beneschan

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