Bug 11603 – std.algorithm.canFind does not work when needle is 1-byte zero
Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-11-25T10:03:00Z
Last change time
2014-01-15T11:41:32Z
Keywords
pull, rejects-valid
Assigned to
nobody
Creator
bearophile_hugs
Comments
Comment #0 by bearophile_hugs — 2013-11-25T10:03:53Z
I think used to work in dmd v2.063.2:
import std.algorithm: canFind;
void main() {
enum Foo { x }
[Foo.x].canFind(Foo.x);
}
With dmd 2.065alpha it gives:
...\dmd2\windows\bin\..\..\src\phobos\std\algorithm.d(3834): Error: template instance std.traits.isSomeChar!(Foo) recursive expansion
Comment #1 by k.hara.pg — 2013-12-03T17:03:29Z
*** This issue has been marked as a duplicate of issue 11610 ***
Comment #2 by bearophile_hugs — 2013-12-03T18:47:08Z
I think the problem is not yet solved, see:
void main() {
import std.algorithm: canFind;
enum Foo : ubyte { A }
assert([Foo.A].canFind(Foo.A));
}