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]

[Ada] Attributes on predicated subtypes


To prevent anomalies with enumeration types with holes and scalar types with
complex predicates, the attributes First, Last, and Range cannot be applied to
subtypes with predicates. This rule applies only to scalar types.

The following must compile quietly in Ada2012 mode:

package Pred is
   type A is array (Integer range <>) of Integer
     with Predicate => (for all J in A'Range =>
                          (for all K in A'Range =>
                             (if J /= K then A (J) /= A (K))));
end Pred;

Tested on x86_64-pc-linux-gnu, committed on trunk

2011-08-04  Ed Schonberg  <schonberg@adacore.com>

	* sem_attr.adb (Bad_Attribute_For_Predicate): flag illegal use of
	attribute only if prefix type is scalar.

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]