aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/sem_attr.adb
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2017-05-02 11:06:41 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2017-05-02 11:06:41 +0200
commitd6fd1f07ac1f21f0dd84202088102b7b77bcd104 (patch)
tree090074251d194c3bc6f75ede05214292ce38ebfa /gcc/ada/sem_attr.adb
parent2d249f52b53c9c4b0d6fdbd1490f3871d1df5d40 (diff)
downloadgcc-d6fd1f07ac1f21f0dd84202088102b7b77bcd104.zip
gcc-d6fd1f07ac1f21f0dd84202088102b7b77bcd104.tar.gz
gcc-d6fd1f07ac1f21f0dd84202088102b7b77bcd104.tar.bz2
[multiple changes]
2017-05-02 Bob Duff <duff@adacore.com> * sem_attr.adb (Attribute_Enum_Rep): Disallow T'Enum_Rep. 2017-05-02 Vasiliy Fofanov <fofanov@adacore.com> * s-os_lib.ads: Minor typo fix. 2017-05-02 Vasiliy Fofanov <fofanov@adacore.com> * gnatls.adb: Merge and refactor code from Prj.Env and remove this deprecated dependency. 2017-05-02 Ed Schonberg <schonberg@adacore.com> * exp_util.ads: minor comment addition. 2017-05-02 Eric Botcazou <ebotcazou@adacore.com> * sem_ch3.adb (Build_Derived_Record_Type): Fix a few typos and pastos in part #3 of the head comment. 2017-05-02 Ed Schonberg <schonberg@adacore.com> * exp_ch3.adb (Freeze_Type): Do not generate an invariant procedure body for a local (sub)type declaration within a predicate function. Invariant checks do not apply to these, and the expansion of the procedure will happen in the wrong scope, leading to misplaced freeze nodes. 2017-05-02 Ed Schonberg <schonberg@adacore.com> * exp_util.adb (Insert_Library_Level_Action): Use proper scope to analyze generated actions. If the main unit is a body, the required scope is that of the corresponding unit declaration. 2017-05-02 Arnaud Charlet <charlet@adacore.com> * einfo.adb (Declaration_Node): flip branches of an IF statement to avoid repeated negations in its condition; no change in semantics, only to improve readability. From-SVN: r247480
Diffstat (limited to 'gcc/ada/sem_attr.adb')
-rw-r--r--gcc/ada/sem_attr.adb14
1 files changed, 12 insertions, 2 deletions
diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb
index 5cbc08c..7f2d105 100644
--- a/gcc/ada/sem_attr.adb
+++ b/gcc/ada/sem_attr.adb
@@ -3763,13 +3763,23 @@ package body Sem_Attr is
--------------
when Attribute_Enum_Rep =>
+ -- T'Enum_Rep (X) case
+
if Present (E1) then
Check_E1;
Check_Discrete_Type;
Resolve (E1, P_Base_Type);
- elsif not Is_Discrete_Type (Etype (P)) then
- Error_Attr_P ("prefix of % attribute must be of discrete type");
+ -- X'Enum_Rep case. X must be an object or enumeration literal, and
+ -- it must be of a discrete type.
+
+ elsif not ((Is_Object_Reference (P)
+ or else (Is_Entity_Name (P)
+ and then Ekind (Entity (P)) =
+ E_Enumeration_Literal))
+ and then Is_Discrete_Type (Etype (P)))
+ then
+ Error_Attr_P ("prefix of % attribute must be discrete object");
end if;
Set_Etype (N, Universal_Integer);