Bug 13990 – std.algorithm.move incorrectly uses hasAliasing for class references
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2015-01-16T19:51:00Z
Last change time
2015-02-18T03:41:20Z
Assigned to
schveiguy
Creator
schveiguy
Comments
Comment #0 by schveiguy — 2015-01-16T19:51:49Z
If we have an opaque class, we can't move the reference with std.algorithm.move:
import std.algorithm.move
class S;
void main()
{
S s;
S s2;
std.algorithm.move(s, s2); // Error, size of S unknown.
}
However, all move has to do is assignment in this case.
The issue is that we have a static if that checks hasAliasing on the class type to do a check for internal pointers, but that is only relevant for structs. It should be moved inside the check to see if it's a struct.
Doing pull request now.