aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@adacore.com>2020-11-30 03:11:40 -0500
committerPierre-Marie de Rodat <derodat@adacore.com>2020-12-17 05:49:19 -0500
commit043d13792116b459cc3c3b1ba5cc7c40aec36719 (patch)
treeabffb9a93a3d1310e89197da3b02be5b444871b1 /gcc
parent337cbb9f9edaebb6cd6dba2f22c9d0437e1f81a0 (diff)
downloadgcc-043d13792116b459cc3c3b1ba5cc7c40aec36719.zip
gcc-043d13792116b459cc3c3b1ba5cc7c40aec36719.tar.gz
gcc-043d13792116b459cc3c3b1ba5cc7c40aec36719.tar.bz2
[Ada] Spurious error on Type'Access and <>
gcc/ada/ * sem_attr.adb (OK_Self_Reference): Return True if node does not come from source (e.g. a rewritten aggregate).
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/sem_attr.adb11
1 files changed, 8 insertions, 3 deletions
diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb
index d5970a1..1f769a5 100644
--- a/gcc/ada/sem_attr.adb
+++ b/gcc/ada/sem_attr.adb
@@ -782,6 +782,13 @@ package body Sem_Attr is
Par : Node_Id;
begin
+ -- If N does not come from source, the reference is assumed to be
+ -- valid.
+
+ if not Comes_From_Source (N) then
+ return True;
+ end if;
+
Par := Parent (N);
while Present (Par)
and then
@@ -1032,9 +1039,7 @@ package body Sem_Attr is
-- expression comes from source, e.g. when a single component
-- association in an aggregate has a box association.
- elsif Ada_Version >= Ada_2005
- and then OK_Self_Reference
- then
+ elsif Ada_Version >= Ada_2005 and then OK_Self_Reference then
null;
-- OK if reference to current instance of a protected object