https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125684

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
The first two are static functions with internal linkage, they could be
changed.

I think the third one is morally wrong. It would still compile if declared as
const, but there's a cast to a non-const type so it would be misleading to
pretend that it's meant for use with const pointers.

The random.cc ones could be changed.

The fs_path.cc one would be bad. It takes an _Impl* and returns an _Impl* from
it, so making it accept const _Impl* would allow implicitly removing the const.
That would be bad.

The last one is just very very wrong. Not only is that function part of the
public ABI, but in print.cc the void* is either passed to Win32 functions
expecting a HANDLE which is a non-const void*, or is cast to FILE* that is
written to. Using const void* would either not compile, or would allow unsafe
writes to a const FILE object.

There is nothing here that needs to be "fixed", and some of the changes would
break things.

Reply via email to