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)); }
Comment #3 by k.hara.pg — 2013-12-03T23:22:56Z
(In reply to comment #2) > 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)); > } This is a Phobos regression caused by: https://github.com/D-Programming-Language/phobos/pull/1492 I commented about the bug on github. https://github.com/D-Programming-Language/phobos/pull/1492/files#r8087442 Reused this issue number for the Phobos bug, and changed the summary.
Comment #4 by k.hara.pg — 2013-12-03T23:29:31Z
Comment #5 by github-bugzilla — 2013-12-04T00:08:11Z
Commits pushed to master at https://github.com/D-Programming-Language/phobos https://github.com/D-Programming-Language/phobos/commit/ab34fb92addca61755474df04a0d0d6e0f1148a2 fix Issue 11603 - std.algorithm.canFind does not work when needle is 1-byte zero https://github.com/D-Programming-Language/phobos/commit/c98f5f58114b798f51f40bf837f924e2afa3f646 Merge pull request #1744 from 9rnsr/fix11603 Issue 11603 - std.algorithm.canFind does not work when needle is 1-byte zero
Comment #6 by github-bugzilla — 2013-12-09T04:04:51Z
Commit pushed to 2.065 at https://github.com/D-Programming-Language/phobos https://github.com/D-Programming-Language/phobos/commit/761dd246ee900118ff14c35d7b2680f8abea16c6 Merge pull request #1744 from 9rnsr/fix11603 Issue 11603 - std.algorithm.canFind does not work when needle is 1-byte zero
Comment #7 by github-bugzilla — 2013-12-19T06:49:35Z
Comment #8 by github-bugzilla — 2013-12-19T07:01:27Z
Commit pushed to 2.065 at https://github.com/D-Programming-Language/phobos https://github.com/D-Programming-Language/phobos/commit/13b8101061b2e5824c0e0a08654922649acf4978 Merge pull request #1744 from 9rnsr/fix11603 Issue 11603 - std.algorithm.canFind does not work when needle is 1-byte zero
Comment #9 by github-bugzilla — 2014-01-15T11:41:32Z