----- import std.array; import std.typecons; struct T { } struct S { RefCounted!T data; } void main() { Appender!(S[]) arr; arr.put(S()); } ----- 2.064: $ dmd test.d > C:\dmd-git\dmd2\windows\bin\..\..\src\phobos\std\array.d(2287): Error: variable std.array.Appender!(S[]).Appender.put!(S).put.item has scoped destruction, cannot build closure However there is another bug in earlier releases: 2.063: $ dmd test.d $ test.exe On win32 this crashes with a dialog box: ----- [Window Title] test.exe [Main Instruction] test.exe has stopped working [Content] A problem caused the program to stop working correctly. Please close the program. [Close the program] [Debug the program] ----- I've traced down the first version that crashes: 2.053: > Crash Earlier releases simply have an assertion failure: 2.052: > core.exception.AssertError@std.typecons(2351): Assertion failure The code which failed there is: ----- assert(RefCounted._store._count > 0); -----
(In reply to comment #0) > 2.064: > $ dmd test.d > > C:\dmd-git\dmd2\windows\bin\..\..\src\phobos\std\array.d(2287): Error: variable std.array.Appender!(S[]).Appender.put!(S).put.item has scoped destruction, cannot build closure The error reporting is a rejects-valid compiler bug. https://github.com/D-Programming-Language/dmd/pull/2548
(In reply to comment #1) > (In reply to comment #0) > > 2.064: > > $ dmd test.d > > > C:\dmd-git\dmd2\windows\bin\..\..\src\phobos\std\array.d(2287): Error: variable std.array.Appender!(S[]).Appender.put!(S).put.item has scoped destruction, cannot build closure > > The error reporting is a rejects-valid compiler bug. > > https://github.com/D-Programming-Language/dmd/pull/2548 After the compiler fix applied, the OP code with runtime crash will reproduce.
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/59af1d08e75f14c8082f81b546a12b21b30e5d3b Partial fix for Issue 10666 - Appender does not work with a RefCounted type Essentially this is neigher dmd nor phobos regression, but recent Appender change in 2.064a should not raise "cannot build closure" error. https://github.com/D-Programming-Language/dmd/commit/aea5806539d9073c85bc7533a6177af6cf6465cb Merge pull request #2548 from 9rnsr/fix10666 Partial fix for Issue 10666 - Appender does not work with a RefCounted type
Is there anything left of this bug to fix before closing it?
(In reply to comment #4) > Is there anything left of this bug to fix before closing it? Yes, this runtime bug has to be fixed: core.exception.InvalidMemoryOperationError
However it shouldn't be filed as a regression anymore, fixing that.