comp.lang.ada
 help / color / mirror / Atom feed
From: Maciej Sobczak <see.my.homepage@gmail.com>
Subject: Obtaining access to protected object
Date: Tue, 8 Jul 2008 13:41:49 -0700 (PDT)
Date: 2008-07-08T13:41:49-07:00	[thread overview]
Message-ID: <72741a06-d96c-4f53-a80b-3595c513efa1@27g2000hsf.googlegroups.com> (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



             reply	other threads:[~2008-07-08 20:41 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-08 20:41 Maciej Sobczak [this message]
2008-07-09 15:03 ` Obtaining access to protected object 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
replies disabled

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