/////////////// test.d ////////////// import std.typecons; alias ObjectWriter = RefCounted!int; ObjectWriter[string] writers; void main() { writers[null] = ObjectWriter(42); auto pwriter = null in writers; assert(*pwriter == 42); } ///////////////////////////////////// Assertion fails on Linux/64. Introduced in https://github.com/D-Programming-Language/dmd/pull/3672
I have reduced the above to the following code: //////////// test.d //////////// struct S { this(int) { } bool okToDestroy; ~this() { assert(okToDestroy); } } S[string] aa; void main() { aa[null] = S(42); aa[null].okToDestroy = true; } //////////////////////////////// But this reduction does not manifest as a regression.
Alternative reduction: //////// test.d //////// struct S { int* count; this(int) { count = new int; *count = 1; } this(this) { ++count; } ~this() { --*count; } } S[string] aa; void main() { aa[null] = S(42); auto p = null in aa; assert(*p.count); } //////////////////////// 2.064.2: works 2.065.0: ICE 2.066.1: assert fails
(In reply to Vladimir Panteleev from comment #2) > ++count; Should be ++*count
The root problem is same with issue 14321, and it's already fixed in git-head (2.068a). *** This issue has been marked as a duplicate of issue 14321 ***