[Issue 8055] [Regression 2.059] std.algorithm.move corrupts moved object field

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun May 6 19:26:11 PDT 2012


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


Kenji Hara <k.hara.pg at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|std.algorithm.move corrupts |[Regression 2.059]
                   |moved object field          |std.algorithm.move corrupts
                   |                            |moved object field
           Severity|normal                      |regression


--- Comment #1 from Kenji Hara <k.hara.pg at gmail.com> 2012-05-06 19:27:29 PDT ---
Sorry, I accidentally posted that is only half written.

(In reply to comment #0)
> import std.algorithm;
> struct S
> {
>     int x;
>     ~this()
>     {
>         assert(x == 0);  // Line7
>     }
> }
> S foo(S s)
> {
>     return move(s);
> }
> void main()
> {
>     S a;
>     a.x = 0;
>     auto b = foo(a);
>     assert(b.x == 0);
> }

output:
----
core.exception.AssertError at test(7): Assertion failure

This regression is introduced this commit:
https://github.com/D-Programming-Language/phobos/commit/71b1c1a

In unary move(), result is uninitialized. If T has an elaborate destructor, it
is called on corrupted memory.

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