From: Eryndlia Mavourneen <eryndlia@gmail.com>
Subject: User-Defined Reference in a Task Type Discriminant Compiler Bug?
Date: Thu, 21 Mar 2013 08:11:08 -0700 (PDT)
Date: 2013-03-21T08:11:08-07:00 [thread overview]
Message-ID: <4ef5e6b7-aab3-4229-a245-97dfc5861b8d@googlegroups.com> (raw)
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.
-----
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? The declaration of Inc_Type is not possible, of course, without the keyword "access".
-----
3) I tried pleasing the compiler by splitting the declaration, as:
type Inc_Type is access procedure (To_Increment : in out Integer);
task type T (Incrementing_Procedure : not null Inc_Type)
with Implicit_Dereference => Incrementing_Procedure;
but Gnat still produces the same error message for the aspect.
-----
Note that the declaration of Inc_Type in (1) is properly recognized as an access-to-subprogram type without the aspect clause. I find it odd that the declaration of the discriminant + aspect clause given a similar circumstance will not compile. It appears to prevent implicitly the type of construct in (1), which seems to me to be legal Ada code.
-----
Eryndlia F. Mavourneen
next reply other threads:[~2013-03-21 15:11 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-21 15:11 Eryndlia Mavourneen [this message]
2013-03-21 19:11 ` User-Defined Reference in a Task Type Discriminant Compiler Bug? Shark8
2013-03-21 19:12 ` Adam Beneschan
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