aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEd Schonberg <schonberg@adacore.com>2014-07-31 13:24:48 +0000
committerArnaud Charlet <charlet@gcc.gnu.org>2014-07-31 15:24:48 +0200
commitf4510e5e6dcb5fe385e5e636a95f87b2a8209361 (patch)
tree2f5ef4ad349912104614f0da787d1b01c3e3cafc
parentd7a93e45289b395c3cb0f43ddb869e1263272102 (diff)
downloadgcc-f4510e5e6dcb5fe385e5e636a95f87b2a8209361.zip
gcc-f4510e5e6dcb5fe385e5e636a95f87b2a8209361.tar.gz
gcc-f4510e5e6dcb5fe385e5e636a95f87b2a8209361.tar.bz2
sem_attr.adb (Analyze_Attribute, case 'Old): The reference is legal if within an aspect specification for a generic subprogram.
2014-07-31 Ed Schonberg <schonberg@adacore.com> * sem_attr.adb (Analyze_Attribute, case 'Old): The reference is legal if within an aspect specification for a generic subprogram. From-SVN: r213362
-rw-r--r--gcc/ada/ChangeLog5
-rw-r--r--gcc/ada/sem_attr.adb12
2 files changed, 13 insertions, 4 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 1c68482..41f233c 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,8 @@
+2014-07-31 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_attr.adb (Analyze_Attribute, case 'Old): The reference is
+ legal if within an aspect specification for a generic subprogram.
+
2014-07-31 Javier Miranda <miranda@adacore.com>
* gnat1drv.adb (Back_End_Inlining): Set to false if
diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb
index 88c3c5d..951ec06 100644
--- a/gcc/ada/sem_attr.adb
+++ b/gcc/ada/sem_attr.adb
@@ -4664,7 +4664,10 @@ package body Sem_Attr is
-- process of being preanalyzed. Perform the semantic checks now
-- before the pragma is relocated and/or expanded.
- if In_Spec_Expression then
+ -- For a generic subprogram, postconditions are preanalyzed as well
+ -- for name capture, and still appear within an aspect spec.
+
+ if In_Spec_Expression or Inside_A_Generic then
Prag := N;
while Present (Prag)
and then not Nkind_In (Prag, N_Aspect_Specification,
@@ -4677,10 +4680,11 @@ package body Sem_Attr is
end loop;
-- In ASIS mode, the aspect itself is analyzed, in addition to the
- -- corresponding pragma. Do not issue errors when analyzing the
- -- aspect.
+ -- corresponding pragma. Don't issue errors when analyzing aspect.
- if Nkind (Prag) = N_Aspect_Specification then
+ if Nkind (Prag) = N_Aspect_Specification
+ and then Chars (Identifier (Prag)) = Name_Post
+ then
null;
-- In all other cases the related context must be a pragma