aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Baird <baird@adacore.com>2023-02-15 16:13:06 -0800
committerMarc Poulhiès <poulhies@adacore.com>2023-05-23 09:59:05 +0200
commit0fb36084e3ef8fb0eef232b41a8257f119b26864 (patch)
treef056be48eebd901246fc1098c181689c090ffaeb
parent583acc4d8e570e738516463cc1c6afcce22ee13d (diff)
downloadgcc-0fb36084e3ef8fb0eef232b41a8257f119b26864.zip
gcc-0fb36084e3ef8fb0eef232b41a8257f119b26864.tar.gz
gcc-0fb36084e3ef8fb0eef232b41a8257f119b26864.tar.bz2
ada: A discriminant of a variable is not a variable
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".
-rw-r--r--gcc/ada/sem_util.adb7
1 files changed, 2 insertions, 5 deletions
diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb
index baf4cef..7e30289 100644
--- a/gcc/ada/sem_util.adb
+++ b/gcc/ada/sem_util.adb
@@ -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.