comp.lang.ada
 help / color / mirror / Atom feed
From: Simon Wright <simon@pushface.org>
Subject: GCC 11 bug? lawyer needed
Date: Mon, 03 May 2021 17:08:20 +0100	[thread overview]
Message-ID: <lyh7jjztor.fsf@pushface.org> (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.

             reply	other threads:[~2021-05-03 16:08 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-03 16:08 Simon Wright [this message]
2021-05-05  3:54 ` GCC 11 bug? lawyer needed 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
replies disabled

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