Bug 4604 – A stack overflow with writeln

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2010-08-09T07:55:00Z
Last change time
2012-02-24T11:42:34Z
Assigned to
andrei
Creator
bearophile_hugs

Comments

Comment #0 by bearophile_hugs — 2010-08-09T07:55:24Z
With dmd 2.048beta this program: import std.stdio, std.regex, std.array; void main() { writeln(array(match("1", regex(r"\d")).captures)); } prints: [1] While this wrong program: import std.stdio, std.regex, std.array; void main() { writeln(array(match("1", regex(r"\d")))); } Produces: object.Error: Stack Overflow [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[...]
Comment #1 by bearophile_hugs — 2011-06-06T11:09:15Z
Dmitry Olshansky has suggested me to add this that comes from issue 4627: To me this program crashes at runtime (DMD 2.053): import std.stdio, std.regex; void main() { foreach (m; match("125 155 ss25", r"\d+")) writeln(m); } If I use this line it works: writeln(m.toString());
Comment #2 by dmitry.olsh — 2012-02-24T11:42:34Z
Now it works as expected but without .toString (which is OK IMHO there is no toString documented). Since 2.056+ most likely.