comp.lang.ada
 help / color / mirror / Atom feed
* GCC 11 bug? lawyer needed
@ 2021-05-03 16:08 Simon Wright
  2021-05-05  3:54 ` Randy Brukardt
  0 siblings, 1 reply; 10+ messages in thread
From: Simon Wright @ 2021-05-03 16:08 UTC (permalink / raw)


This code results in the error shown:

     1. package Aliased_Tagged_Types is
     2.
     3.    type T is tagged null record;
     4.
     5.    function P (Param : aliased T) return Boolean
     6.      is (False);
     7.
     8.    function F (Param : T) return Boolean
     9.      is (Param.P);
                 |
        >>> actual for explicitly aliased formal is too short lived

    10.
    11. end Aliased_Tagged_Types;

The compiler code that results in this error is at sem_ch4.adb:1490, and
was introduced for Ada202x accessibiity checking reasons.

   --  Check whether the formal is aliased and if the accessibility
   --  level of the actual is deeper than the accessibility level
   --  of the enclosing subprogam to which the current return
   --  statement applies.

   [...]

   if Is_Explicitly_Aliased (Form)
     and then Is_Entity_Name (Act)
     and then Static_Accessibility_Level
                (Act, Zero_On_Dynamic_Level)
                  > Subprogram_Access_Level (Current_Subprogram)
   then
      Error_Msg_N ("actual for explicitly aliased formal is too"
                    & " short lived", Act);
   end if;

----

For those interested, this issue affects Alire.

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2021-05-08 10:17 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2021-05-06 20:51           ` Dmitry A. Kazakov
2021-05-06 23:59           ` Randy Brukardt
2021-05-08 10:17             ` Simon Wright

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