diff options
author | Ed Schonberg <schonberg@adacore.com> | 2020-09-10 15:57:06 -0400 |
---|---|---|
committer | Pierre-Marie de Rodat <derodat@adacore.com> | 2020-10-26 04:59:00 -0400 |
commit | cfc3a1db82cb6a11e9bdfc903f71fb116c9b6706 (patch) | |
tree | c4af1863f29ca85f8e028c65520658060dd7bfcc /gcc/ada | |
parent | adf1c867c01eece19081c157d2c6bf05f7848c64 (diff) | |
download | gcc-cfc3a1db82cb6a11e9bdfc903f71fb116c9b6706.zip gcc-cfc3a1db82cb6a11e9bdfc903f71fb116c9b6706.tar.gz gcc-cfc3a1db82cb6a11e9bdfc903f71fb116c9b6706.tar.bz2 |
[Ada] Spurious error on Old attribute reference in delta aggregate
gcc/ada/
* sem_aggr.adb (Resolve_Delta_Array_Aggregate): For an
association that is an iterated component association, attach
the copy of the expression to the tree prior to analysis, in
order to preserve its context. This is needed when verifying
static semantic rules that depend on context, for example that a
use of 'Old appears only within a postcondition.
Diffstat (limited to 'gcc/ada')
-rw-r--r-- | gcc/ada/sem_aggr.adb | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/gcc/ada/sem_aggr.adb b/gcc/ada/sem_aggr.adb index c75c10f..35c53bd 100644 --- a/gcc/ada/sem_aggr.adb +++ b/gcc/ada/sem_aggr.adb @@ -3026,6 +3026,7 @@ package body Sem_Aggr is Assoc : Node_Id; Choice : Node_Id; + Expr : Node_Id; begin Assoc := First (Deltas); @@ -3062,8 +3063,12 @@ package body Sem_Aggr is end if; Enter_Name (Id); - Analyze_And_Resolve - (New_Copy_Tree (Expression (Assoc)), Component_Type (Typ)); + -- Resolve a copy of the expression, after setting + -- its parent properly to preserve its context. + + Expr := New_Copy_Tree (Expression (Assoc)); + Set_Parent (Expr, Assoc); + Analyze_And_Resolve (Expr, Component_Type (Typ)); End_Scope; end; |