From: Simon Wright <simon@pushface.org>
Subject: Re: GCC 11 bug? lawyer needed
Date: Thu, 06 May 2021 21:02:54 +0100 [thread overview]
Message-ID: <lylf8ry6j5.fsf@pushface.org> (raw)
In-Reply-To: s6vdrg$l09$1@franka.jacob-sparre.dk
"Randy Brukardt" <randy@rrsoftware.com> writes:
> I agree that the original author of that program should not have used
> "aliased" in the way that they did (they don't need the special semantics),
> but we realize that some people would prefer to *explicitly* mark things as
> aliased when they are going to take 'Access (and not worry about the type of
> the parameter -- after all, it could change). That is, they don't want to
> depend on the implicit behavior of tagged types -- or perhaps they don't
> even know about it. Which leads to the problem that occurs here, as
> "aliased" has slightly different meanings for functions (now just composite
> functions) and procedures.
The original code, from the Alire project, had (I've edited it slightly)
package Holders
is new Ada.Containers.Indefinite_Holders (Node'Class);
type Tree is
new Holders.Holder
and ...
function Root (This : Tree) return Node'Class is
(This.Constant_Reference);
where that Constant_Reference is inherited (eventually) from
Ada.Containers.Indefinite_Holders.Holder,
function Constant_Reference
(Container : aliased Holder) return Constant_Reference_Type;
pragma Inline (Constant_Reference);
Shame it had to be there.
I've just tried splattering 'aliased' wherever the compiler told me it
was needed; it's now spreading into other packages. Ugh.
The solution might just be using composition rather than inheritance.
next prev parent reply other threads:[~2021-05-06 20:02 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-03 16:08 GCC 11 bug? lawyer needed Simon Wright
2021-05-05 3:54 ` Randy Brukardt
2021-05-05 10:01 ` AdaMagica
2021-05-05 16:10 ` AdaMagica
2021-05-06 0:39 ` Randy Brukardt
2021-05-06 13:07 ` AdaMagica
2021-05-06 20:02 ` Simon Wright [this message]
2021-05-06 20:51 ` Dmitry A. Kazakov
2021-05-06 23:59 ` Randy Brukardt
2021-05-08 10:17 ` Simon Wright
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox