www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 10094] New: NRVO with static array return should work

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10094

           Summary: NRVO with static array return should work
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: k.hara.pg gmail.com


--- Comment #0 from Kenji Hara <k.hara.pg gmail.com> 2013-05-16 07:03:12 PDT ---
Following code should pass assertions, but doesn't.

void main()
{
    static void* p;
    const string[4] i2s = ()
    {
        string[4] tmp;
        p = &tmp[0];
        for (int i = 0; i < 4; ++i)
        {
            char[1] buf = [cast(char)('0' + i)];
            string str = buf.idup;
            tmp[i] = str;
        }
        return tmp; // NRVO should work
    }();
    assert(p == cast(void*)&i2s[0]);
    assert(i2s == ["0", "1", "2", "3"]);
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 16 2013
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10094


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |performance, pull


--- Comment #1 from Kenji Hara <k.hara.pg gmail.com> 2013-05-16 08:25:23 PDT ---
https://github.com/D-Programming-Language/dmd/pull/2042

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 16 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10094



--- Comment #2 from github-bugzilla puremagic.com 2013-06-24 09:13:33 PDT ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/6d79158a06a91a987eb8a5c837435e10020b56a0
fix Issue 10094 - NRVO with static array return should work

https://github.com/D-Programming-Language/dmd/commit/9d298c0d5ede6a45ae9e505a66618044fbaeb2b8
Merge pull request #2042 from 9rnsr/fix10094

Issue 10094 - NRVO with static array return should work

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 24 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10094


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla digitalmars.com
         Resolution|                            |FIXED


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