[Issue 7992] std.algorithm.find breaks in certain circumstances

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Oct 9 21:19:50 PDT 2012


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


hsteoh at quickfur.ath.cx changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hsteoh at quickfur.ath.cx


--- Comment #2 from hsteoh at quickfur.ath.cx 2012-10-09 20:55:47 PDT ---
OK, something is very broken in simpleMindedFind(). When both haystack and
needle have the length property, estimateNeedleLength is set to false, and
estimatedNeedleLength is set to 0. Therefore, haystackTooShort() is always
false.

So in the searching loop, the if(haystackTooShort()) is skipped, and it falls
straight through to the for(auto h=haystack.save;...) loop. But here, if
h.empty is true, then because estimateNeedleLength is false, this goes straight
to "continue searching", which calls popFront() on an empty range.

-- 
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