This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
This patch fixes a bug in which the compiler fails to give an error on T'Enum_Rep, where T is a type. If X is an object of enumeration type T, then X'Enum_Rep and T'Enum_Rep(X) are allowed, but not T'Enum_Rep. The following test must get an error. enum_val_test.adb:4:21: prefix of "Enum_Rep" attribute must be discrete object procedure Enum_Val_Test is type Color is (Red, Orange, Yellow); Current_Index : Color := Orange; Rep : Integer := Color'Enum_Rep; -- Illegal! begin null; end Enum_Val_Test; Tested on x86_64-pc-linux-gnu, committed on trunk 2017-05-02 Bob Duff <duff@adacore.com> * sem_attr.adb (Attribute_Enum_Rep): Disallow T'Enum_Rep.
Attachment:
difs
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |