Thread overview
[Issue 10666] New: Regresion (2.064 git-head, 2.053+): Appender does not work with a RefCounted type
Jul 18, 2013
Andrej Mitrovic
Sep 11, 2013
Kenji Hara
Sep 11, 2013
Kenji Hara
Oct 07, 2013
Brad Roberts
Oct 07, 2013
Andrej Mitrovic
[Issue 10666] Appender does not work with a RefCounted type
Oct 07, 2013
Andrej Mitrovic
July 18, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10666

           Summary: Regresion (2.064 git-head, 2.053+): Appender does not
                    work with a RefCounted type
           Product: D
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: regression
          Priority: P2
         Component: Phobos
        AssignedTo: nobody@puremagic.com
        ReportedBy: andrej.mitrovich@gmail.com


--- Comment #0 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2013-07-18 06:59:59 PDT ---
-----
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);
-----

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
September 11, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10666


Kenji Hara <k.hara.pg@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull


--- Comment #1 from Kenji Hara <k.hara.pg@gmail.com> 2013-09-10 18:05:31 PDT ---
(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

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
September 11, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10666



--- Comment #2 from Kenji Hara <k.hara.pg@gmail.com> 2013-09-10 18:07:31 PDT ---
(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.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
September 15, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10666



--- Comment #3 from github-bugzilla@puremagic.com 2013-09-14 23:50:31 PDT ---
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

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
October 07, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10666


Brad Roberts <braddr@puremagic.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |braddr@puremagic.com


--- Comment #4 from Brad Roberts <braddr@puremagic.com> 2013-10-06 20:28:12 PDT ---
Is there anything left of this bug to fix before closing it?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
October 07, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10666



--- Comment #5 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2013-10-07 07:35:23 PDT ---
(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

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
October 07, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10666


Andrej Mitrovic <andrej.mitrovich@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Regresion (2.064 git-head,  |Appender does not work with
                   |2.053+): Appender does not  |a RefCounted type
                   |work with a RefCounted type |
           Severity|regression                  |normal


--- Comment #6 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2013-10-07 07:36:53 PDT ---
However it shouldn't be filed as a regression anymore, fixing that.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------