https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124596

--- Comment #6 from Liam Powell <liam at liampwll dot com> ---
> The case itself is fairly pathological (and very likely not human made)

I'm aware the patterns in this code are odd, however there are good reason for
them. They might have been avoided by a better design, but it's a bit late to
change that now.

The reason for this weird interface pattern is because the below pattern, which
is what the real program this is from actually wants to do, doesn't work
(perhaps it should, but that's a problem for the ARG, I believe GNAT is
following the RM correctly here):

   type I is synchronized interface;
   --  Shared by many packages.
   type Instance is synchronized new I with private;
   --  Must remain private as it contains procedures which need to be called
   --  from outside of the protected object within the package, but never
   --  outside of the package.
   procedure P (This : in out Instance);

   protected type Instance is new I with
      procedure P;
   end Instance;

The reason for the seemingly useless generic here is that we have access types
of these protected types being passed around, so as soon as one package needs
to be generic then they all need to be generic due to accessibility levels.

Reply via email to