Bug 17995 – template NoDuplicates(TList...) bug.

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2017-11-20T06:31:09Z
Last change time
2017-12-18T22:57:05Z
Assigned to
No Owner
Creator
shove

Comments

Comment #0 by shove — 2017-11-20T06:31:09Z
Phobos version: 2.077.0 file: std/meta.d line: 486 template NoDuplicates(TList...) { ... static if (TList.length > 500) { enum steps = 16; alias first = NoDuplicates!(TList[0 .. steps]); alias NoDuplicates = NoDuplicates!(EraseAllN!(first.length, first, TList[steps..$])); } ... } When processing step by step here, forget to process 'first'.
Comment #1 by simen.kjaras — 2017-11-20T07:14:46Z
Example code that demonstrates the behavior: import std.meta; alias a = NoDuplicates!(AliasSeq!(1, Repeat!(1000, 3))); alias b = NoDuplicates!(AliasSeq!(1, Repeat!(10, 3))); static assert(a.length == b.length); a is AliasSeq!(3), b is AliasSeq!(1,3).
Comment #2 by simen.kjaras — 2017-11-20T07:19:24Z
Comment #3 by simen.kjaras — 2017-11-20T08:52:10Z
Comment #4 by github-bugzilla — 2017-11-21T19:27:47Z
Commits pushed to master at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/a6e9b151fe63ca1098fa75456f925a7b69135572 Fix issue 17995 https://github.com/dlang/phobos/commit/284e5210edca36ad4d279850dd369c503706dd90 Merge pull request #5867 from Biotronic/issue17995 Fix issue 17995 merged-on-behalf-of: Martin Nowak <[email protected]>
Comment #5 by github-bugzilla — 2017-12-18T22:57:05Z