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] Expression of static predicate should be static


This patch updates the mechanism which creates predicate functions to ensure
that the expression of a static predicate is static.

------------
-- Source --
------------

--  pack.ads

package Pack is
   subtype T1 is Integer with Dynamic_Predicate => T1 /= 0;
   subtype T2 is T1 with Static_Predicate => T2 mod 2 = 0;
end Pack;

----------------------------
-- Compilation and output --
----------------------------

$ gcc -c -gnat12 pack.ads
pack.ads:3:55: expression does not have required form for static predicate

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

2013-04-25  Hristian Kirtchev  <kirtchev@adacore.com>

	* sem_ch13.adb (Add_Call): Do not capture the nature of the inherited
	predicate.
	(Add_Predicates): Save the static predicate for diagnostics and error
	reporting purposes.
	(Process_PPCs): Remove local variables Dynamic_Predicate_Present and
	Static_Predicate_Present. Add local variable Static_Pred. Ensure that
	the expression of a static predicate is static.

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]