September 16, 2019 [Issue 20218] New: Checked format string takes infinite time for infinite ranges | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=20218 Issue ID: 20218 Summary: Checked format string takes infinite time for infinite ranges Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Severity: normal Priority: P1 Component: phobos Assignee: nobody@puremagic.com Reporter: acehreli@yahoo.com dmd 2.088 does not stop compiling the following program seemingly because it is expanding the infinite range at compile time: import std.string; import std.range; void main() { format!"%s"(1.repeat); } 1) SAME PROBLEM for writefln 2) SAME PROBLEM for element formatters %( and %): format!"%(%s%)"(1.repeat); 3) SIMILAR PROBLEM: Apparently, it can take "close to infinite time" if the range is large. The following line either does not finish compilation or takes a very long time (I did not wait): format!"%s"(1.repeat(1_000_000_000)); Ali -- |
Copyright © 1999-2021 by the D Language Foundation