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: [email protected]
        ReportedBy: [email protected]


--- Comment #0 from Kenji Hara <[email protected]> 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: -------

Reply via email to