2008-05-28 Robert Dewar <dewar@adacore.com>
* gnat_rm.texi: Add note on Old giving warning when applied to constant
* sem_attr.adb (Analyze_Attribute, case Old): Give warning if prefix is
a constant
From-SVN: r136078
end Old_Pkg;
@end smallexample
+@noindent
+Note that it is allowed to apply 'Old to a constant entity, but this will
+result in a warning, since the old and new values will always be the same.
+
@node Passed_By_Reference
@unnumberedsec Passed_By_Reference
@cindex Parameters, when passed by reference
Error_Attr ("attribute % cannot apply to limited objects", P);
end if;
+ if Is_Entity_Name (P)
+ and then Is_Constant_Object (Entity (P))
+ then
+ Error_Msg_N
+ ("?attribute Old applied to constant has no effect", P);
+ end if;
+
-- Check that the expression does not refer to local entities
Check_Local : declare