end if;
-- Analyze actions generated by freezing. The init_proc contains source
- -- expressions that may raise Constraint_Error, and the assignment
+ -- expressions that may raise Constraint_Error, the assignment
-- procedure for complex types needs checks on individual component
- -- assignments, but all other freezing actions should be compiled with
- -- all checks off.
+ -- assignments, and wrappers may need checks. Other freezing actions
+ -- should be compiled with all checks off.
if Present (Actions (N)) then
Decl := First (Actions (N));
if Nkind (Decl) = N_Subprogram_Body
and then (Is_Init_Proc (Defining_Entity (Decl))
or else
- Chars (Defining_Entity (Decl)) = Name_uAssign)
+ Chars (Defining_Entity (Decl)) = Name_uAssign
+ or else
+ (Present (Corresponding_Spec (Decl))
+ and then Is_Wrapper
+ (Corresponding_Spec (Decl))))
then
Analyze (Decl);
Mutate_Ekind (Func_Id, E_Function);
Set_Is_Wrapper (Func_Id);
+ -- Corresponding_Spec will be set again to the same value during
+ -- analysis, but we need this information earlier.
+ -- Expand_N_Freeze_Entity needs to know whether a subprogram body
+ -- is a wrapper's body in order to get check suppression right.
+
+ Set_Corresponding_Spec (Func_Body, Func_Id);
+
Override_Dispatching_Operation (Tag_Typ, Subp, New_Op => Func_Id);
end if;