[Issue 18256] Using std.range.put to put a character into a dchar[] segfaults

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Mar 22 18:49:53 UTC 2018


https://issues.dlang.org/show_bug.cgi?id=18256

John Colvin <john.loughran.colvin at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|---                         |INVALID

--- Comment #3 from John Colvin <john.loughran.colvin at gmail.com> ---
This is nothing to do with `put`. As far as `put` is concerned it's been given
a mutable buffer.

A segfault is a good outcome when you try to write to a string literal.

Do you mean a compile-time error? If so:

I suggest opening an enhancement request for something like "Disallow obvious
cases of writing to string literals" or similar, but I doubt you'll get much
traction with it as it's only practically possible to do in trivial cases and
only occurs when someone has already broken the rules by casting away
immutable.

If you mean a runtime error:

That's what the segfault is for. There's no need to duplicate the work that the
CPU does (with all the performance implications that would have).


I'm gonna close this again, re-open if you're really motivated but I think a
new issue would be better, without the confusion of `put`.

--


More information about the Digitalmars-d-bugs mailing list