[Issue 11224] New: Inlining stops NRVO
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Oct 11 03:21:30 PDT 2013
http://d.puremagic.com/issues/show_bug.cgi?id=11224
Summary: Inlining stops NRVO
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Keywords: wrong-code
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-10-11 03:21:24 PDT ---
Test code:
------------
extern(C) int printf(const char*, ...);
struct S
{
this(int) { printf("ctor &this = %p\n", &this); }
int num;
}
S foo()
{
S s = S(1);
printf("foo &this = %p\n", &s);
return s;
}
void main()
{
auto s = foo();
printf("main &this = %p\n", &s);
}
Output:
------------
$ dmd -run test
ctor &this = 0012FE20
foo &this = 0012FE20
main &this = 0012FE20
------------
$ dmd -inline -run test
ctor &this = 0012FE1C
foo &this = 0012FE1C
main &this = 0012FE18 // variable is moved!
--
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