Bug 16054 – can break immutable with std.typecons.Rebindable

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2016-05-21T22:01:00Z
Last change time
2016-10-01T11:45:35Z
Keywords
pull
Assigned to
ag0aep6g
Creator
ag0aep6g

Comments

Comment #0 by ag0aep6g — 2016-05-21T22:01:37Z
---- import std.typecons: Rebindable; class C { int x; this(int x) pure { this.x = x; } } void main() { Rebindable!(immutable C) ic = new immutable C(1); immutable(C)* p = &ic.get(); assert(p.x == 1); /* passes */ scope (exit) assert(p.x == 1); /* fails */ ic = new immutable C(2); } ---- As far as I see, Rebindable can't be allowed to return a reference to its tail-immutable payload.
Comment #1 by ag0aep6g — 2016-05-21T22:37:18Z
Comment #2 by github-bugzilla — 2016-06-18T09:10:47Z
Commits pushed to master at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/b391486693ba26cb58ac93efa102975c634093fc fix issue 16054 - can break immutable with std.typecons.Rebindable https://github.com/dlang/phobos/commit/5d6569a3e5ab8d5bc21d0831a68b1198df251bc2 Merge pull request #4344 from aG0aep6G/16054 fix issue 16054 - can break immutable with std.typecons.Rebindable
Comment #3 by github-bugzilla — 2016-10-01T11:45:35Z