[Issue 8057] New: std.algorithm.move cannot use for nested struct

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun May 6 20:30:01 PDT 2012


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: nobody at puremagic.com
        ReportedBy: k.hara.pg at gmail.com


--- Comment #0 from Kenji Hara <k.hara.pg at 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 at test(11): Assertion failure

-- 
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