Bug 5492 – immutable string can be changed by stdin.readln

Status
RESOLVED
Resolution
DUPLICATE
Severity
major
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
Other
OS
Windows
Creation time
2011-01-26T12:50:00Z
Last change time
2011-01-26T13:10:20Z
Keywords
accepts-invalid
Assigned to
nobody
Creator
hoganmeier

Comments

Comment #0 by hoganmeier — 2011-01-26T12:50:13Z
import std.stdio; void main() { immutable char[] buf = "hello"; writefln("buf = %s",buf); stdin.readln(buf); writefln("buf = %s",buf); } compiles and runs without errors. Steven said it segfaults on Linux.
Comment #1 by schveiguy — 2011-01-26T13:10:20Z
Marking this as the duplicate, since the original poster made the later bug (both reports are pretty much identical) *** This issue has been marked as a duplicate of issue 5493 ***