Analyze_And_Resolve (N, Typ);
-- Whenever possible, replace a prefix which is an enumeration literal
- -- by the corresponding literal value.
+ -- by the corresponding literal value, just like it happens in the GNAT
+ -- expander.
elsif Attr_Id = Attribute_Enum_Rep then
declare
-- If the argument is a literal, expand it
if Nkind (Expr) in N_Has_Entity
- and then
- (Ekind (Entity (Expr)) = E_Enumeration_Literal
- or else
- (Nkind (Expr) in N_Has_Entity
- and then Ekind (Entity (Expr)) = E_Constant
- and then Present (Renamed_Object (Entity (Expr)))
- and then Is_Entity_Name (Renamed_Object (Entity (Expr)))
- and then Ekind (Entity (Renamed_Object (Entity (Expr)))) =
- E_Enumeration_Literal))
+ and then Ekind (Entity (Expr)) = E_Enumeration_Literal
then
Exp_Attr.Expand_N_Attribute_Reference (N);
end if;