http://d.puremagic.com/issues/show_bug.cgi?id=8057

           Summary: std.algorithm.move cannot use for nested struct
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nob...@puremagic.com
        ReportedBy: k.hara...@gmail.com


--- Comment #0 from Kenji Hara <k.hara...@gmail.com> 2012-05-06 20:31:19 PDT ---
import std.algorithm;
void main()
{
    int n = 10;
    struct S
    {
        int x;
        ~this()
        {
            // Access to enclosing scope
            assert(n == 10);    // Line11
        }
    }
    S foo(S s)
    {
        // Move nested struct
        return move(s);
    }
    S a;
    a.x = 1;
    auto b = foo(a);
    import core.stdc.stdio;
    printf("a.x = %d\n", a.x);
    assert(b.x == 1);
}

output:
----
core.exception.AssertError@test(11): Assertion failure

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

Reply via email to