Correct span in privacy error

Fix #19062.
No, but bounds in functions and structs (also methods, enums, etc.) are checked by the same code. I don't think separate tests are necessary. (Or, if they are necessary, tests for methods, enums, etc. are also necessary.)