Bug 17519 – RedBlackTree doesn't like const/immutable elements

Status
RESOLVED
Resolution
FIXED
Severity
minor
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2017-06-17T21:56:21Z
Last change time
2018-01-05T13:29:24Z
Keywords
pull
Assigned to
ag0aep6g
Creator
ag0aep6g

Comments

Comment #0 by ag0aep6g — 2017-06-17T21:56:21Z
Simple examples where immutable/const is meaningless: ---- import std.container.rbtree: RedBlackTree; void main() { RedBlackTree!(immutable int) t1; /* fails; should compile */ RedBlackTree!(const int) t2; /* fails; should compile */ } ---- It matters when the element type has indirections: ---- import std.algorithm: map; import std.container.rbtree: RedBlackTree; void main() { static struct S { int* p; } auto t3 = new RedBlackTree!(immutable S, (a, b) => *a.p < *b.p); /* fails; should compile */ t3.insert([1, 2, 3].map!(x => immutable S(new int(x)))); static assert(!__traits(compiles, *t3.front.p = 4)); } ----
Comment #1 by ag0aep6g — 2017-06-17T22:01:38Z
Comment #2 by github-bugzilla — 2017-06-18T09:25:14Z
Commits pushed to stable at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/29c7f36df591e3137233460940cdd824a745786c fix issue 17519 - RedBlackTree doesn't like const/immutable elements https://github.com/dlang/phobos/commit/173ccd835b5080dde5eec00d0ddae35a954b87cd Merge pull request #5492 from aG0aep6G/rbtree-immutable fix issue 17519 - RedBlackTree doesn't like const/immutable elements merged-on-behalf-of: Petar Kirov <[email protected]>
Comment #3 by github-bugzilla — 2017-06-26T15:14:11Z
Commits pushed to master at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/29c7f36df591e3137233460940cdd824a745786c fix issue 17519 - RedBlackTree doesn't like const/immutable elements https://github.com/dlang/phobos/commit/173ccd835b5080dde5eec00d0ddae35a954b87cd Merge pull request #5492 from aG0aep6G/rbtree-immutable
Comment #4 by github-bugzilla — 2018-01-05T13:29:24Z
Commits pushed to dmd-cxx at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/29c7f36df591e3137233460940cdd824a745786c fix issue 17519 - RedBlackTree doesn't like const/immutable elements https://github.com/dlang/phobos/commit/173ccd835b5080dde5eec00d0ddae35a954b87cd Merge pull request #5492 from aG0aep6G/rbtree-immutable