Bug 13379 – Latest dmd fails with recursive template expansion in std.regex

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-08-27T00:12:00Z
Last change time
2014-09-02T02:14:24Z
Keywords
pull, rejects-valid
Assigned to
nobody
Creator
hsteoh

Comments

Comment #0 by hsteoh — 2014-08-27T00:12:09Z
Test case (use Phobos git HEAD to reproduce): ------ void main() { import std.regex : match; "".match(""); } ------ Compiler output: ------ /usr/src/d/phobos/std/algorithm.d(7168): Error: template instance std.algorithm.MinType!(uint, uint) recursive expansion ------ git bisect reveals that the offending commit in dmd is: 9202b529b329ce0087ae976aa8bf1deadd1b62de Distinguish speculative instantiation from gagged one to elide unnecessary symbol emission
Comment #1 by hsteoh — 2014-08-27T00:25:47Z
Comment #2 by k.hara.pg — 2014-08-27T01:29:57Z
Reduced test case: void main() { match(""); } // Instantiating Regex!char in template constraint auto match(RegEx )(RegEx re) if (is(RegEx == Regex!(char))) {} auto match(String)(String re) {} struct Regex(Char) { ShiftOr!Char kickstart; } struct ShiftOr(Char) { this(ref Regex!Char re) // Regex!Char is necessary { uint n_length; uint idx; n_length = min(idx, n_length); } } MinType!T min(T...)(T args)// if (T.length == 2) { alias a = args[0]; alias b = args[$-1]; return cast(typeof(return)) (a < b ? a : b); } template MinType(T...)// if (T.length == 2) { alias MinType = T[0]; }
Comment #3 by k.hara.pg — 2014-08-27T06:47:01Z
Comment #4 by dlang-bugzilla — 2014-08-29T10:15:17Z
*** Issue 13398 has been marked as a duplicate of this issue. ***
Comment #5 by john.loughran.colvin — 2014-08-29T10:40:37Z
This issue currently prevents dub from compiling on git HEAD.
Comment #6 by github-bugzilla — 2014-08-31T18:37:47Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/5efa203c22ba4b49f2366f71d1104c2aaf37b144 fix Issue 13379 - Latest dmd fails with recursive template expansion in std.regex https://github.com/D-Programming-Language/dmd/commit/178d02e1dac49ba9ac301183037146c5d8d68e2a Merge pull request #3905 from 9rnsr/fix13379 [REG2.067a] Issue 13379 - Latest dmd fails with recursive template expansion in std.regex
Comment #7 by github-bugzilla — 2014-09-02T02:14:24Z
Commit pushed to 2.066 at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/f3a52eac94c30d6a2917504a1d2be2ef8e0f2ba3 Merge pull request #3905 from 9rnsr/fix13379 [REG2.067a] Issue 13379 - Latest dmd fails with recursive template expansion in std.regex