[Issue 10094] New: NRVO with static array return should work
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu May 16 07:03:14 PDT 2013
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 at puremagic.com
ReportedBy: k.hara.pg at gmail.com
--- Comment #0 from Kenji Hara <k.hara.pg at 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: -------
More information about the Digitalmars-d-bugs
mailing list