[Ada] No ABE check needed for an expression function call.
authorSteve Baird <baird@adacore.com>
Thu, 5 Aug 2021 03:23:31 +0000 (20:23 -0700)
committerPierre-Marie de Rodat <derodat@adacore.com>
Fri, 1 Oct 2021 06:13:35 +0000 (06:13 +0000)
gcc/ada/

* sem_elab.adb (Is_Safe_Call): Return True in the case of a
(possibly rewritten) call to an expression function.

gcc/ada/sem_elab.adb

index 7635ae1..122a837 100644 (file)
@@ -13621,6 +13621,13 @@ package body Sem_Elab is
       then
          return True;
 
+      --  A call to an expression function that is not a completion cannot
+      --  cause an ABE because it has no prior declaration; this remains
+      --  true even if the FE transforms the callee into something else.
+
+      elsif Nkind (Original_Node (Spec_Decl)) = N_Expression_Function then
+         return True;
+
       --  Subprogram bodies which wrap attribute references used as actuals
       --  in instantiations are always ABE-safe. These bodies are artifacts
       --  of expansion.