From d6fd1f07ac1f21f0dd84202088102b7b77bcd104 Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Tue, 2 May 2017 11:06:41 +0200 Subject: [multiple changes] 2017-05-02 Bob Duff * sem_attr.adb (Attribute_Enum_Rep): Disallow T'Enum_Rep. 2017-05-02 Vasiliy Fofanov * s-os_lib.ads: Minor typo fix. 2017-05-02 Vasiliy Fofanov * gnatls.adb: Merge and refactor code from Prj.Env and remove this deprecated dependency. 2017-05-02 Ed Schonberg * exp_util.ads: minor comment addition. 2017-05-02 Eric Botcazou * 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 * 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 * 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 * 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 --- gcc/ada/sem_attr.adb | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'gcc/ada/sem_attr.adb') 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); -- cgit v1.1