diff options
author | Bob Duff <duff@adacore.com> | 2016-07-06 12:32:35 +0000 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2016-07-06 14:32:35 +0200 |
commit | 1956beb8aa91181d614441e943a76fa7f7d8d51c (patch) | |
tree | ab3dafd3172a46b0fe10aff675670eb0e1ee1947 /gcc/ada/sem_attr.adb | |
parent | 7b4e076985f2c41f93fb8d8f89183ef1244f98ae (diff) | |
download | gcc-1956beb8aa91181d614441e943a76fa7f7d8d51c.zip gcc-1956beb8aa91181d614441e943a76fa7f7d8d51c.tar.gz gcc-1956beb8aa91181d614441e943a76fa7f7d8d51c.tar.bz2 |
sem_attr.adb (Analyze_Attribute): Allow any expression of discrete type.
2016-07-06 Bob Duff <duff@adacore.com>
* 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
Diffstat (limited to 'gcc/ada/sem_attr.adb')
-rw-r--r-- | gcc/ada/sem_attr.adb | 12 |
1 files changed, 2 insertions, 10 deletions
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); |