3.2.2 Subtype Declarations
Syntax
subtype_mark ::= subtype_name 
Name Resolution Rules
Dynamic Semantics
The condition imposed by a 
constraint 
is the condition obtained after elaboration of the 
constraint. 
The rules defining compatibility are given for each 
form of 
constraint 
in the appropriate subclause. These rules are such that if a 
constraint 
is 
compatible with a subtype, then the condition imposed by the 
constraint 
cannot contradict any condition already imposed by the subtype on its 
values. 
The exception Constraint_Error is raised 
if any check of compatibility fails. 
 
4  A 
scalar_constraint 
may be applied to a subtype of an appropriate scalar type (see 
3.5, 
3.5.9, and 
J.3), 
even if the subtype is already constrained. On the other hand, a 
composite_constraint 
may be applied to a composite subtype (or an access-to-composite subtype) 
only if the composite subtype is unconstrained (see 
3.6.1 
and 
3.7.1). 
 
Examples
Examples of subtype 
declarations: 
subtype Rainbow   
is Color 
range Red .. Blue;        --
  see 3.2.1
subtype Red_Blue  
is Rainbow;
subtype Int       
is Integer;
subtype Small_Int 
is Integer 
range -10 .. 10;
subtype Up_To_K   
is Column 
range 1 .. K;            --
  see 3.2.1
subtype Square    
is Matrix(1 .. 10, 1 .. 10);       --
  see 3.6
subtype Male      
is Person(Sex => M);               --
  see 3.10.1
subtype Binop_Ref 
is not null Binop_Ptr;             --
  see 3.10 
Ada 2005 and 2012 Editions sponsored in part by Ada-Europe