Bug 10094 – NRVO with static array return should work

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-05-16T07:03:00Z
Last change time
2013-06-24T09:13:54Z
Keywords
performance, pull
Assigned to
nobody
Creator
k.hara.pg

Comments

Comment #0 by k.hara.pg — 2013-05-16T07:03:12Z
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"]); }
Comment #1 by k.hara.pg — 2013-05-16T08:25:23Z
Comment #2 by github-bugzilla — 2013-06-24T09:13:33Z
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