Behavior of Index with null character mapping function?

Ada.Strings.Fixed declares:

function Index (Source   : in String;
                   Pattern  : in String;
                   Going    : in Direction := Forward;
                   Mapping  : in Maps.Character_Mapping_Function)
      return Natural;

What about passing a null Mapping parameter?

I haven’t found any clue in RM A.4.3 Fixed-Length String Handling.

Is there a specific non documented behavior?

Should’t Mapping parameter be protected with not null exclusion?

ARM A.4.3(109) says

If a null Character_Mapping_Function is passed to any of the string handling subprograms, Constraint_Error is propagated.

It will be: Look at the coming Ada202y Draft 4 RM. AI22-0035-1 added not null.

2 Likes

Well, NOTE 3 at the very bottom of the page, I missed it, thanks Jeff :innocent:

Thanks for the information :+1: