[Issue 4984] string mixn results in dmd running out of memory

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Apr 11 14:50:21 PDT 2011


http://d.puremagic.com/issues/show_bug.cgi?id=4984


kennytm at gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kennytm at gmail.com
            Version|unspecified                 |D2
         OS/Version|Linux                       |All


--- Comment #2 from kennytm at gmail.com 2011-04-11 14:46:35 PDT ---
This is likely due to the recursive template constraint used in
std.algorithm.startsWith. A reduced test case:

---------------

void x(U...)(U args) if ( is(typeof( x(args[1..$]) )) ) {
}

void x(U)(U u) {
}

void main() {
    x(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20);
}

---------------

Similar test case:

---------------

void x(int n)() if (n > 0 && is(typeof(x!(n-1) ()))) {
}

void x(int n : 0)() {
}

void main() {
    x!20();
}

---------------

Phobos could workaround this by moving the recursive part into a
static-if/static-assert.

(Note: I only check if it consumes an unusually large amount memory and does
not stop. I didn't wait until it runs out of memory.)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list