]> gcc.gnu.org Git - gcc.git/commitdiff
[Ada] Spurious accessibility error on call in return statement
authorJustin Squirek <squirek@adacore.com>
Tue, 22 Dec 2020 14:58:43 +0000 (09:58 -0500)
committerPierre-Marie de Rodat <derodat@adacore.com>
Mon, 3 May 2021 09:28:22 +0000 (05:28 -0400)
gcc/ada/

* sem_util.adb (In_Return_Value): Modified to detect when
implicit dereference is specified on the return type of a
function call within the expression being checked.

gcc/ada/sem_util.adb

index c4fe191211fe578eb8b0532ba227470f4e7d700e..7b24a40419418122003dc5aa060599649ca5b268 100644 (file)
@@ -14329,6 +14329,17 @@ package body Sem_Util is
             when N_Function_Call =>
                if not In_Function_Call then
                   In_Function_Call := True;
+
+                  --  When the function return type has implicit dereference
+                  --  specified we know it cannot directly contribute to the
+                  --  return value.
+
+                  if Present (Etype (Par))
+                    and then Has_Implicit_Dereference
+                               (Get_Full_View (Etype (Par)))
+                  then
+                     return False;
+                  end if;
                else
                   return False;
                end if;
This page took 0.087661 seconds and 5 git commands to generate.