]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: A discriminant of a variable is not a variable
authorSteve Baird <baird@adacore.com>
Thu, 16 Feb 2023 00:13:06 +0000 (16:13 -0800)
committerMarc Poulhiès <poulhies@adacore.com>
Tue, 23 May 2023 07:59:05 +0000 (09:59 +0200)
gcc/ada/

* sem_util.adb
(Is_Variable): Correctly return False for a selected component
name of the form Some_Object.Some_Discriminant, even if
Some_Object is a variable. We don't want to allow such a name as
an actual parameter in a call if the corresponding formal
parameter's mode is not "in".

gcc/ada/sem_util.adb

index baf4cefdfb32f75c8ee59b21f02d8f058d468e8f..7e302897888ce31716fc72ab2bf2fbc183db83c9 100644 (file)
@@ -21196,11 +21196,8 @@ package body Sem_Util is
                return Is_Variable_Prefix (Prefix (Orig_Node));
 
             when N_Selected_Component =>
-               return (Is_Variable (Selector_Name (Orig_Node))
-                        and then Is_Variable_Prefix (Prefix (Orig_Node)))
-                 or else
-                   (Nkind (N) = N_Expanded_Name
-                     and then Scope (Entity (N)) = Entity (Prefix (N)));
+               return Is_Variable (Selector_Name (Orig_Node))
+                       and then Is_Variable_Prefix (Prefix (Orig_Node));
 
             --  For an explicit dereference, the type of the prefix cannot
             --  be an access to constant or an access to subprogram.