AI22-0060-1

!standard 11.5(8)                                    23-03-15  AI22-0060-1/01

!class binding interpretation  23-03-15

!status work item 23-03-15

!status received 23-03-15

!priority Low

!difficulty Easy

!qualifier Clarification

!subject Clarify interactions between defaults and check suppression

!summary

Check suppression for a use of a default_expression or default_name is determined as if the expression/name occurred explicitly at the place where it is used.

!issue

Consider this example:

package Pkg is
   package Nested1 is

      pragma Suppress (Index_Check);
      type String_Ref is access String;
      Ptr : String_Ref := … ;
      function Func
        (C : Character := Ptr.all(3)) return Boolean is (...);
   end Nested1;
   package Nested2 is
      pragma Suppress (Access_Check);
      Flag : Boolean := Nested1.Func;
   end Nested;

end Example;

 

What check suppression is in effect for the evaluation of the expression “Ptr.all(3)” ?

[Access checking is suppressed, index checking is not suppressed.]

!recommendation

Clarify that the check suppression that is in effect for the evaluation of a default_expression or default_name is determined by the place of the construct that evaluates the default (and not by the place of the default expression/name itself). This rule applies recursively in the case of a default expression/name that itself includes, for example, a call with a defaulted parameter.

!wording

Add after 11.5(8.1):

   In the case of evaluating a Default_Expression or Default_Name, the

   applicable check suppression is determined by the place where the

   evaluation occurs [redundant:, and not by where the construct occurs.]

   AARM note: This is analogous to the freezing rules for these constructs.

!discussion

Another alternative would be to “or” the suppression permissions at the place where the default occurs and where it is used (and presumably any intermediate places in the case of a default whose evaluation evaluates other defaults). That would pretty much ensure that existing implementations would not be required to make any changes, but it seems overly complex.

!example

See !Issue.

!ACATS test

We don’t write ACATS tests to test check suppression.

!appendix