The rules for static predicates do not allow the type name to be parenthesized. This was not checked, but is now fixed, the following test now gives the error indicated (compiled with -gnatld7 -gnatj55) (it used to compile without errors).
1. package BadParenSP is 2. subtype r is integer with 3. static_predicate => (r) < 2; | >>> expression does not have required form for static predicate 4. end; Tested on x86_64-pc-linux-gnu, committed on trunk 2014-07-18 Robert Dewar <de...@adacore.com> * sem_ch13.adb (Is_Type_Ref): Check that type name is not parenthesized.
Index: sem_ch13.adb =================================================================== --- sem_ch13.adb (revision 212797) +++ sem_ch13.adb (working copy) @@ -6247,7 +6247,8 @@ pragma Inline (Is_Type_Ref); -- Returns if True if N is a reference to the type for the predicate in -- the expression (i.e. if it is an identifier whose Chars field matches - -- the Nam given in the call). + -- the Nam given in the call). N must not be parenthesized, if the type + -- name appears in parens, this routine will return False. function Lo_Val (N : Node_Id) return Uint; -- Given static expression or static range from a Static_Predicate list, @@ -6770,7 +6771,9 @@ function Is_Type_Ref (N : Node_Id) return Boolean is begin - return Nkind (N) = N_Identifier and then Chars (N) = Nam; + return Nkind (N) = N_Identifier + and then Chars (N) = Nam + and then Paren_Count (N) = 0; end Is_Type_Ref; ------------