From 1956beb8aa91181d614441e943a76fa7f7d8d51c Mon Sep 17 00:00:00 2001 From: Bob Duff Date: Wed, 6 Jul 2016 12:32:35 +0000 Subject: sem_attr.adb (Analyze_Attribute): Allow any expression of discrete type. 2016-07-06 Bob Duff * sem_attr.adb (Analyze_Attribute): Allow any expression of discrete type. * exp_attr.adb (Expand_N_Attribute_Reference): Change the constant-folding code to correctly handle cases newly allowed by Analyze_Attribute. From-SVN: r238042 --- gcc/ada/sem_attr.adb | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to 'gcc/ada/sem_attr.adb') diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb index d6d8509..a05ad7e 100644 --- a/gcc/ada/sem_attr.adb +++ b/gcc/ada/sem_attr.adb @@ -3742,16 +3742,8 @@ package body Sem_Attr is Check_E1; Check_Discrete_Type; Resolve (E1, P_Base_Type); - - else - if not Is_Entity_Name (P) - or else (not Is_Object (Entity (P)) - and then Ekind (Entity (P)) /= E_Enumeration_Literal) - then - Error_Attr_P - ("prefix of % attribute must be " & - "discrete type/object or enum literal"); - end if; + elsif not Is_Discrete_Type (Etype (P)) then + Error_Attr_P ("prefix of % attribute must be of discrete type"); end if; Set_Etype (N, Universal_Integer); -- cgit v1.1