digitalmars.D.bugs - [Issue 21702] New: avoid quadratic template expansion in constraints
- d-bugmail puremagic.com (30/30) Mar 12 2021 https://issues.dlang.org/show_bug.cgi?id=21702
https://issues.dlang.org/show_bug.cgi?id=21702 Issue ID: 21702 Summary: avoid quadratic template expansion in constraints of multiple search term versions of std.algorithm.searching.startsWith & endsWith Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: normal Priority: P1 Component: phobos Assignee: nobody puremagic.com Reporter: n8sh.secondary hotmail.com than 22 gigabytes of memory to compile (the process got killed before finishing). There is other stuff going on too but fixing this problem is enough to make the example compile. The culprit is: --- uint endsWith(alias pred = "a == b", Range, Needles...)(Range doesThisEnd, Needles withOneOfThese) if (isBidirectionalRange!Range && Needles.length > 1 && is(typeof(.endsWith!pred(doesThisEnd, withOneOfThese[0])) : bool) && is(typeof(.endsWith!pred(doesThisEnd, withOneOfThese[1 .. $])) : uint)) --- Because in certain situations this is causing the compiler to hang I think it is reasonable to consider this a bug fix rather than an enhancement. --
Mar 12 2021