[Issue 5661] New: std.algorithm.move does not work on elaborate struct
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Feb 27 21:32:58 PST 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5661
Summary: std.algorithm.move does not work on elaborate struct
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Severity: major
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> 2011-02-27 21:30:08 PST ---
Created an attachment (id=924)
testcase
std.algorithm.move does not work on T that hasElaborateDestructor!T or
hasElaborateCopyConstructor!T.
This test should work.
----
unittest
{
static struct S
{
static struct X
{
int n = 0;
~this(){n = 0;}
}
X x;
}
static assert(hasElaborateDestructor!S);
S s1, s2;
s1.x.n = 1;
move(s1, s2);
assert(s1.x.n == 0);
assert(s2.x.n == 1);
static struct T
{
static struct X
{
int n = 0;
this(this){n = 0;}
}
X x;
}
static assert(hasElaborateCopyConstructor!T);
T t1, t2;
t1.x.n = 1;
move(t1, t2);
assert(t1.x.n == 0);
assert(t2.x.n == 1);
}
----
See also attached file of full test case.
--
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