comp.lang.ada
 help / color / mirror / Atom feed
From: Adam Beneschan <adam@irvine.com>
Subject: Re: User-Defined Reference in a Task Type Discriminant Compiler Bug?
Date: Thu, 21 Mar 2013 12:12:57 -0700 (PDT)
Date: 2013-03-21T12:12:57-07:00	[thread overview]
Message-ID: <65c510a2-1571-4730-b264-501b6b861346@googlegroups.com> (raw)
In-Reply-To: <4ef5e6b7-aab3-4229-a245-97dfc5861b8d@googlegroups.com>

On Thursday, March 21, 2013 8:11:08 AM UTC-7, Eryndlia Mavourneen wrote:
> Dmitry spurred me to investigate user-defined references.
> 

> 1) The following code does not compile; however, it seems to abide by the LRM rules in 4.1.5:
>    type Inc_Type is not null access procedure (To_Increment : in out Integer);
> 
>    task type T (Incrementing_Procedure : Inc_Type)
>    with Implicit_Dereference => Incrementing_Procedure; 
>
> and fails with the error
>  
>    not an access discriminant of "T"
> 
> referencing the aspect clause.

Right.  An "access discriminant" isn't any old discriminant with an access type; 
3.7(9/2) says

"A discriminant that is defined by an access_definition is called an access discriminant and is of an anonymous access type."

So to be an "access discriminant" it has to have the word "access" in it, e.g.

task type T (Incrementing_Procedure : 
               not null access procedure (To_Increment : in out integer)) 
   with Implicit_Dereference => Incrementing_Procedure; 

 
> 2) Adding "access" before the discriminant type in the task declaration compiles:
> 
>    type Inc_Type is not null access procedure (To_Increment : in out Integer);
> 
>    task type T (Incrementing_Procedure : access Inc_Type)
>    with Implicit_Dereference => Incrementing_Procedure;
> 
> but I believe that this will produce an access of an access, no?

Right.  I don't think that's what you want.

                        -- Adam



  parent reply	other threads:[~2013-03-21 19:12 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-21 15:11 User-Defined Reference in a Task Type Discriminant Compiler Bug? Eryndlia Mavourneen
2013-03-21 19:11 ` Shark8
2013-03-21 19:12 ` Adam Beneschan [this message]
2013-03-21 19:43   ` Simon Wright
2013-03-21 23:49 ` Randy Brukardt
2013-03-22  1:15 ` Eryndlia Mavourneen
replies disabled

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